diff core/modules/serialization/src/EntityResolver/UuidResolver.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/modules/serialization/src/EntityResolver/UuidResolver.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/modules/serialization/src/EntityResolver/UuidResolver.php	Thu Feb 28 13:21:36 2019 +0000
@@ -2,7 +2,7 @@
 
 namespace Drupal\serialization\EntityResolver;
 
-use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityRepositoryInterface;
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
 
 /**
@@ -11,20 +11,20 @@
 class UuidResolver implements EntityResolverInterface {
 
   /**
-   * The entity manager.
+   * The entity repository.
    *
-   * @var \Drupal\Core\Entity\EntityManagerInterface
+   * @var \Drupal\Core\Entity\EntityRepositoryInterface
    */
-  protected $entityManager;
+  protected $entityRepository;
 
   /**
    * Constructs a UuidResolver object.
    *
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
+   * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
+   *   The entity repository.
    */
-  public function __construct(EntityManagerInterface $entity_manager) {
-    $this->entityManager = $entity_manager;
+  public function __construct(EntityRepositoryInterface $entity_repository) {
+    $this->entityRepository = $entity_repository;
   }
 
   /**
@@ -35,7 +35,7 @@
     // deserialized. If it can return a UUID from that data, and if there's an
     // entity with that UUID, then return its ID.
     if (($normalizer instanceof UuidReferenceInterface) && ($uuid = $normalizer->getUuid($data))) {
-      if ($entity = $this->entityManager->loadEntityByUuid($entity_type, $uuid)) {
+      if ($entity = $this->entityRepository->loadEntityByUuid($entity_type, $uuid)) {
         return $entity->id();
       }
     }