Issue #3115772 by saurabh.rocksoul, swatichouhan012, Wim Leers, alexpott: User::load calls should be avoided in classes, use dependency injection instead in jsonapi module
(cherry picked from commit 8b7aee5be4
)
merge-requests/64/head
parent
5a71f0fdea
commit
26bb167e10
|
@ -14,7 +14,6 @@ use Drupal\jsonapi\JsonApiResource\ResourceObjectData;
|
|||
use Drupal\jsonapi\ResourceResponse;
|
||||
use Drupal\jsonapi\ResourceType\ResourceType;
|
||||
use Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface;
|
||||
use Drupal\user\Entity\User;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
|
||||
|
@ -104,7 +103,7 @@ class EntryPoint extends ControllerBase {
|
|||
|
||||
$meta = [];
|
||||
if ($this->user->isAuthenticated()) {
|
||||
$current_user_uuid = User::load($this->user->id())->uuid();
|
||||
$current_user_uuid = $this->entityTypeManager()->getStorage('user')->load($this->user->id())->uuid();
|
||||
$meta['links']['me'] = ['meta' => ['id' => $current_user_uuid]];
|
||||
$cacheability->addCacheContexts(['user']);
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue