diff --git a/core/core.services.yml b/core/core.services.yml index 0d75946..8a7aa2f 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -492,7 +492,7 @@ services: arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state'] entity.manager: class: Drupal\Core\Entity\EntityManager - arguments: ['@entity_type.manager', '@entity_type.repository', '@entity_type.bundle.manager', '@entity_display.manager', '@entity_field.manager', '@entity_definition.repository', '@entity.repository', '@entity_type.listener', '@entity_bundle.listener', '@field_storage_definition.listener', '@field_definition.listener'] + arguments: ['@entity_type.manager', '@entity_type.repository', '@entity_type.bundle.manager', '@entity_display.repository', '@entity_field.manager', '@entity_definition.repository', '@entity.repository', '@entity_type.listener', '@entity_bundle.listener', '@field_storage_definition.listener', '@field_definition.listener'] # @todo Remove this tag in https://www.drupal.org/node/2549143. tags: - { name: plugin_manager_cache_clear } @@ -511,12 +511,12 @@ services: entity.repository: class: Drupal\Core\Entity\EntityRepository arguments: ['@entity_type.manager', '@language_manager'] - entity_display.manager: - class: Drupal\Core\Entity\EntityDisplayManager + entity_display.repository: + class: Drupal\Core\Entity\EntityDisplayRepository arguments: ['@entity_type.manager', '@module_handler', '@cache.discovery', '@language_manager'] entity_field.manager: class: Drupal\Core\Entity\EntityFieldManager - arguments: ['@entity_type.manager', '@entity_type.bundle.manager', '@entity_display.manager', '@typed_data_manager', '@language_manager', '@keyvalue', '@module_handler', '@cache.discovery'] + arguments: ['@entity_type.manager', '@entity_type.bundle.manager', '@entity_display.repository', '@typed_data_manager', '@language_manager', '@keyvalue', '@module_handler', '@cache.discovery'] entity_type.listener: class: Drupal\Core\Entity\EntityTypeListener arguments: ['@entity_type.manager', '@entity_field.manager', '@event_dispatcher', '@entity_definition.repository'] diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayManager.php b/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php similarity index 96% rename from core/lib/Drupal/Core/Entity/EntityDisplayManager.php rename to core/lib/Drupal/Core/Entity/EntityDisplayRepository.php index cb23e27..e201508 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayManager.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayRepository.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Entity\EntityDisplayManager. + * Contains \Drupal\Core\Entity\EntityDisplayRepository. */ namespace Drupal\Core\Entity; @@ -15,9 +15,9 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; /** - * Manages the discovery of entity display objects (view modes and form modes). + * Provides a repository for entity display objects (view modes and form modes). */ -class EntityDisplayManager implements EntityDisplayManagerInterface { +class EntityDisplayRepository implements EntityDisplayRepositoryInterface { use CacheBackendTrait; use StringTranslationTrait; @@ -51,7 +51,7 @@ class EntityDisplayManager implements EntityDisplayManagerInterface { protected $moduleHandler; /** - * Constructs a new EntityDisplayManager. + * Constructs a new EntityDisplayRepository. * * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityDisplayRepositoryInterface.php similarity index 93% rename from core/lib/Drupal/Core/Entity/EntityDisplayManagerInterface.php rename to core/lib/Drupal/Core/Entity/EntityDisplayRepositoryInterface.php index 5219aec..ece9aa0 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayRepositoryInterface.php @@ -2,15 +2,15 @@ /** * @file - * Contains \Drupal\Core\Entity\EntityDisplayManagerInterface. + * Contains \Drupal\Core\Entity\EntityDisplayRepositoryInterface. */ namespace Drupal\Core\Entity; /** - * Provides an interface for an entity display manager. + * Provides an interface for an entity display repository. */ -interface EntityDisplayManagerInterface { +interface EntityDisplayRepositoryInterface { /** * Gets the entity view mode info for all entity types. diff --git a/core/lib/Drupal/Core/Entity/EntityFieldManager.php b/core/lib/Drupal/Core/Entity/EntityFieldManager.php index 03fbe02..9aa8d23 100644 --- a/core/lib/Drupal/Core/Entity/EntityFieldManager.php +++ b/core/lib/Drupal/Core/Entity/EntityFieldManager.php @@ -122,11 +122,11 @@ class EntityFieldManager implements EntityFieldManagerInterface { protected $entityTypeBundleManager; /** - * The entity display manager. + * The entity display repository. * - * @var \Drupal\Core\Entity\EntityDisplayManagerInterface + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface */ - protected $entityDisplayManager; + protected $entityDisplayRepository; /** * Constructs a new EntityFieldManager. @@ -135,8 +135,8 @@ class EntityFieldManager implements EntityFieldManagerInterface { * The entity type manager. * @param \Drupal\Core\Entity\EntityTypeBundleManagerInterface $entity_type_bundle_manager * The entity type bundle manager. - * @param \Drupal\Core\Entity\EntityDisplayManagerInterface $entity_display_manager - * The entity display manager. + * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository + * The entity display repository. * @param \Drupal\Core\TypedData\TypedDataManager $typed_data_manager * The typed data manager. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager @@ -148,10 +148,10 @@ class EntityFieldManager implements EntityFieldManagerInterface { * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * The cache backend. */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleManagerInterface $entity_type_bundle_manager, EntityDisplayManagerInterface $entity_display_manager, TypedDataManager $typed_data_manager, LanguageManagerInterface $language_manager, KeyValueFactoryInterface $key_value_factory, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend) { + public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleManagerInterface $entity_type_bundle_manager, EntityDisplayRepositoryInterface $entity_display_repository, TypedDataManager $typed_data_manager, LanguageManagerInterface $language_manager, KeyValueFactoryInterface $key_value_factory, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend) { $this->entityTypeManager = $entity_type_manager; $this->entityTypeBundleManager = $entity_type_bundle_manager; - $this->entityDisplayManager = $entity_display_manager; + $this->entityDisplayRepository = $entity_display_repository; $this->typedDataManager = $typed_data_manager; $this->languageManager = $language_manager; @@ -542,7 +542,7 @@ public function clearCachedFieldDefinitions() { $this->fieldStorageDefinitions = []; $this->fieldMap = []; $this->fieldMapByFieldType = []; - $this->entityDisplayManager->clearDisplayModeInfo(); + $this->entityDisplayRepository->clearDisplayModeInfo(); $this->extraFields = []; Cache::invalidateTags(['entity_field_info']); // The typed data manager statically caches prototype objects with injected diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 0fc4469..246ee7f 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -44,11 +44,11 @@ class EntityManager implements EntityManagerInterface { protected $entityTypeBundleManager; /** - * The entity display manager. + * The entity display repository. * - * @var \Drupal\Core\Entity\EntityDisplayManagerInterface + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface */ - protected $entityDisplayManager; + protected $entityDisplayRepository; /** * The entity field manager. @@ -108,8 +108,8 @@ class EntityManager implements EntityManagerInterface { * The entity type repository. * @param \Drupal\Core\Entity\EntityTypeBundleManagerInterface $entity_type_bundle_manager * The entity type bundle manager. - * @param \Drupal\Core\Entity\EntityDisplayManagerInterface $entity_display_manager - * The entity display manager. + * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository + * The entity display repository. * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager * The entity field manager. * @param \Drupal\Core\Entity\EntityInstalledDefinitionRepositoryInterface $entity_installed_definition_repository @@ -125,12 +125,12 @@ class EntityManager implements EntityManagerInterface { * @param \Drupal\Core\Field\FieldDefinitionListenerInterface $field_definition_listener * The field definition listener. */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeRepositoryInterface $entity_type_repository, EntityTypeBundleManagerInterface $entity_type_bundle_manager, EntityDisplayManagerInterface $entity_display_manager, EntityFieldManagerInterface $entity_field_manager, EntityInstalledDefinitionRepositoryInterface $entity_installed_definition_repository, EntityRepositoryInterface $entity_repository, EntityTypeListenerInterface $entity_type_listener, EntityBundleListenerInterface $entity_bundle_listener, FieldStorageDefinitionListenerInterface $field_storage_definition_listener, FieldDefinitionListenerInterface $field_definition_listener) { + public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeRepositoryInterface $entity_type_repository, EntityTypeBundleManagerInterface $entity_type_bundle_manager, EntityDisplayRepositoryInterface $entity_display_repository, EntityFieldManagerInterface $entity_field_manager, EntityInstalledDefinitionRepositoryInterface $entity_installed_definition_repository, EntityRepositoryInterface $entity_repository, EntityTypeListenerInterface $entity_type_listener, EntityBundleListenerInterface $entity_bundle_listener, FieldStorageDefinitionListenerInterface $field_storage_definition_listener, FieldDefinitionListenerInterface $field_definition_listener) { $this->entityTypeManager = $entity_type_manager; $this->entityTypeRepository = $entity_type_repository; $this->entityTypeBundleManager = $entity_type_bundle_manager; - $this->entityDisplayManager = $entity_display_manager; + $this->entityDisplayRepository = $entity_display_repository; $this->entityFieldManager = $entity_field_manager; $this->entityInstalledDefinitionRepository = $entity_installed_definition_repository; $this->entityRepository = $entity_repository; @@ -396,7 +396,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getAllViewModes() { - return $this->entityDisplayManager->getAllViewModes(); + return $this->entityDisplayRepository->getAllViewModes(); } /** @@ -405,7 +405,7 @@ public function getAllViewModes() { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getViewModes($entity_type_id) { - return $this->entityDisplayManager->getViewModes($entity_type_id); + return $this->entityDisplayRepository->getViewModes($entity_type_id); } /** @@ -414,7 +414,7 @@ public function getViewModes($entity_type_id) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getAllFormModes() { - return $this->entityDisplayManager->getAllFormModes(); + return $this->entityDisplayRepository->getAllFormModes(); } /** @@ -423,7 +423,7 @@ public function getAllFormModes() { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getFormModes($entity_type_id) { - return $this->entityDisplayManager->getFormModes($entity_type_id); + return $this->entityDisplayRepository->getFormModes($entity_type_id); } /** @@ -432,7 +432,7 @@ public function getFormModes($entity_type_id) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getViewModeOptions($entity_type_id) { - return $this->entityDisplayManager->getViewModeOptions($entity_type_id); + return $this->entityDisplayRepository->getViewModeOptions($entity_type_id); } /** @@ -441,7 +441,7 @@ public function getViewModeOptions($entity_type_id) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getFormModeOptions($entity_type_id) { - return $this->entityDisplayManager->getFormModeOptions($entity_type_id); + return $this->entityDisplayRepository->getFormModeOptions($entity_type_id); } /** @@ -450,7 +450,7 @@ public function getFormModeOptions($entity_type_id) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getViewModeOptionsByBundle($entity_type_id, $bundle) { - return $this->entityDisplayManager->getViewModeOptionsByBundle($entity_type_id, $bundle); + return $this->entityDisplayRepository->getViewModeOptionsByBundle($entity_type_id, $bundle); } /** @@ -459,7 +459,7 @@ public function getViewModeOptionsByBundle($entity_type_id, $bundle) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function getFormModeOptionsByBundle($entity_type_id, $bundle) { - return $this->entityDisplayManager->getFormModeOptionsByBundle($entity_type_id, $bundle); + return $this->entityDisplayRepository->getFormModeOptionsByBundle($entity_type_id, $bundle); } /** @@ -468,7 +468,7 @@ public function getFormModeOptionsByBundle($entity_type_id, $bundle) { * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ public function clearDisplayModeInfo() { - $this->entityDisplayManager->clearDisplayModeInfo(); + $this->entityDisplayRepository->clearDisplayModeInfo(); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php index c0e8816..d415063 100644 --- a/core/lib/Drupal/Core/Entity/EntityManagerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php @@ -15,7 +15,7 @@ * * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. */ -interface EntityManagerInterface extends EntityTypeListenerInterface, EntityBundleListenerInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface, EntityTypeManagerInterface, EntityTypeRepositoryInterface, EntityTypeBundleManagerInterface, EntityDisplayManagerInterface, EntityFieldManagerInterface, EntityRepositoryInterface { +interface EntityManagerInterface extends EntityTypeListenerInterface, EntityBundleListenerInterface, FieldStorageDefinitionListenerInterface, FieldDefinitionListenerInterface, EntityTypeManagerInterface, EntityTypeRepositoryInterface, EntityTypeBundleManagerInterface, EntityDisplayRepositoryInterface, EntityFieldManagerInterface, EntityRepositoryInterface { /** * @see \Drupal\Core\Entity\EntityInstalledDefinitionRepositoryInterface::getLastInstalledDefinition() diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php index 50e43f9..bc62920 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php @@ -14,7 +14,7 @@ use Drupal\Core\Config\Entity\ConfigEntityStorageInterface; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\EntityDisplayManagerInterface; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityFieldManager; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeBundleManagerInterface; @@ -115,11 +115,11 @@ class EntityFieldManagerTest extends UnitTestCase { protected $entityTypeBundleManager; /** - * The entity display manager. + * The entity display repository. * - * @var \Drupal\Core\Entity\EntityDisplayManagerInterface|\Prophecy\Prophecy\ProphecyInterface + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface|\Prophecy\Prophecy\ProphecyInterface */ - protected $entityDisplayManager; + protected $entityDisplayRepository; /** * The entity field manager under test. @@ -174,9 +174,9 @@ public function setUp() { $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class); $this->entityTypeRepository = $this->prophesize(EntityTypeRepositoryInterface::class); $this->entityTypeBundleManager = $this->prophesize(EntityTypeBundleManagerInterface::class); - $this->entityDisplayManager = $this->prophesize(EntityDisplayManagerInterface::class); + $this->entityDisplayRepository = $this->prophesize(EntityDisplayRepositoryInterface::class); - $this->entityFieldManager = new TestEntityFieldManager($this->entityTypeManager->reveal(), $this->entityTypeBundleManager->reveal(), $this->entityDisplayManager->reveal(), $this->typedDataManager->reveal(), $this->languageManager->reveal(), $this->keyValueFactory->reveal(), $this->moduleHandler->reveal(), $this->cacheBackend->reveal()); + $this->entityFieldManager = new TestEntityFieldManager($this->entityTypeManager->reveal(), $this->entityTypeBundleManager->reveal(), $this->entityDisplayRepository->reveal(), $this->typedDataManager->reveal(), $this->languageManager->reveal(), $this->keyValueFactory->reveal(), $this->moduleHandler->reveal(), $this->cacheBackend->reveal()); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index 6a3f8e7..95a912f 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityBundleListenerInterface; use Drupal\Core\Entity\EntityInstalledDefinitionRepositoryInterface; -use Drupal\Core\Entity\EntityDisplayManagerInterface; +use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityRepositoryInterface; @@ -57,11 +57,11 @@ class EntityManagerTest extends UnitTestCase { protected $entityTypeBundleManager; /** - * The entity display manager. + * The entity display repository. * - * @var \Drupal\Core\Entity\EntityDisplayManagerInterface|\Prophecy\Prophecy\ProphecyInterface + * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface|\Prophecy\Prophecy\ProphecyInterface */ - protected $entityDisplayManager; + protected $entityDisplayRepository; /** * The entity field manager. @@ -121,7 +121,7 @@ protected function setUp() { $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class); $this->entityTypeRepository = $this->prophesize(EntityTypeRepositoryInterface::class); $this->entityTypeBundleManager = $this->prophesize(EntityTypeBundleManagerInterface::class); - $this->entityDisplayManager = $this->prophesize(EntityDisplayManagerInterface::class); + $this->entityDisplayRepository = $this->prophesize(EntityDisplayRepositoryInterface::class); $this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class); $this->entityTypeListener = $this->prophesize(EntityTypeListenerInterface::class); $this->entityInstalledDefinitionRepository = $this->prophesize(EntityInstalledDefinitionRepositoryInterface::class); @@ -131,7 +131,7 @@ protected function setUp() { $this->fieldStorageDefinitionListener = $this->prophesize(FieldStorageDefinitionListenerInterface::class); $this->fieldDefinitionListener = $this->prophesize(FieldDefinitionListenerInterface::class); - $this->entityManager = new EntityManager($this->entityTypeManager->reveal(), $this->entityTypeRepository->reveal(), $this->entityTypeBundleManager->reveal(), $this->entityDisplayManager->reveal(), $this->entityFieldManager->reveal(), $this->entityInstalledDefinitionRepository->reveal(), $this->entityRepository->reveal(), $this->entityTypeListener->reveal(), $this->entityBundleListener->reveal(), $this->fieldStorageDefinitionListener->reveal(), $this->fieldDefinitionListener->reveal()); + $this->entityManager = new EntityManager($this->entityTypeManager->reveal(), $this->entityTypeRepository->reveal(), $this->entityTypeBundleManager->reveal(), $this->entityDisplayRepository->reveal(), $this->entityFieldManager->reveal(), $this->entityInstalledDefinitionRepository->reveal(), $this->entityRepository->reveal(), $this->entityTypeListener->reveal(), $this->entityBundleListener->reveal(), $this->fieldStorageDefinitionListener->reveal(), $this->fieldDefinitionListener->reveal()); } /**