diff --git a/core/modules/config_translation/src/ConfigEntityMapper.php b/core/modules/config_translation/src/ConfigEntityMapper.php index f94dff9928400b37ad1cdecb9704fc704a4252dd..cdf07bfc63b7a0ea5c5195fbd1889ea4cdd00d1a 100644 --- a/core/modules/config_translation/src/ConfigEntityMapper.php +++ b/core/modules/config_translation/src/ConfigEntityMapper.php @@ -5,7 +5,8 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\ConfigEntityInterface; use Drupal\Core\Config\TypedConfigManagerInterface; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteProviderInterface; @@ -21,12 +22,21 @@ */ class ConfigEntityMapper extends ConfigNamesMapper { + use DeprecatedServicePropertyTrait; + + /** + * {@inheritdoc} + */ + protected $deprecatedProperties = [ + 'entityManager' => 'entity.manager', + ]; + /** * The entity manager. * - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityManager; + protected $entityTypeManager; /** * Configuration entity type name. @@ -70,18 +80,18 @@ class ConfigEntityMapper extends ConfigNamesMapper { * The route provider. * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager * The string translation manager. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager + * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity manager. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * The event dispatcher. */ - public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) { + public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) { parent::__construct($plugin_id, $plugin_definition, $config_factory, $typed_config, $locale_config_manager, $config_mapper_manager, $route_provider, $translation_manager, $language_manager, $event_dispatcher); $this->setType($plugin_definition['entity_type']); - $this->entityManager = $entity_manager; + $this->entityTypeManager = $entity_type_manager; } /** @@ -99,7 +109,7 @@ public static function create(ContainerInterface $container, array $configuratio $container->get('plugin.manager.config_translation.mapper'), $container->get('router.route_provider'), $container->get('string_translation'), - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('language_manager'), $container->get('event_dispatcher') ); @@ -152,7 +162,7 @@ public function setEntity(ConfigEntityInterface $entity) { // entity. This is not a Drupal 8 best practice (ideally the configuration // would have pluggable components), but this may happen as well. /** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */ - $entity_type_info = $this->entityManager->getDefinition($this->entityType); + $entity_type_info = $this->entityTypeManager->getDefinition($this->entityType); $this->addConfigName($entity_type_info->getConfigPrefix() . '.' . $entity->id()); return TRUE; @@ -208,7 +218,7 @@ public function getType() { * {@inheritdoc} */ public function getTypeName() { - $entity_type_info = $this->entityManager->getDefinition($this->entityType); + $entity_type_info = $this->entityTypeManager->getDefinition($this->entityType); return $entity_type_info->getLabel(); } @@ -216,7 +226,7 @@ public function getTypeName() { * {@inheritdoc} */ public function getTypeLabel() { - $entityType = $this->entityManager->getDefinition($this->entityType); + $entityType = $this->entityTypeManager->getDefinition($this->entityType); return $entityType->getLabel(); } diff --git a/core/modules/config_translation/src/ConfigFieldMapper.php b/core/modules/config_translation/src/ConfigFieldMapper.php index c0e085f11537ef3e131c1960bf881c95afbd21e5..8f970c696a40ca5d4d77a1e068d14900ddefc03d 100644 --- a/core/modules/config_translation/src/ConfigFieldMapper.php +++ b/core/modules/config_translation/src/ConfigFieldMapper.php @@ -26,7 +26,7 @@ class ConfigFieldMapper extends ConfigEntityMapper { */ public function getBaseRouteParameters() { $parameters = parent::getBaseRouteParameters(); - $base_entity_info = $this->entityManager->getDefinition($this->pluginDefinition['base_entity_type']); + $base_entity_info = $this->entityTypeManager->getDefinition($this->pluginDefinition['base_entity_type']); $bundle_parameter_key = $base_entity_info->getBundleEntityType() ?: 'bundle'; $parameters[$bundle_parameter_key] = $this->entity->getTargetBundle(); return $parameters; @@ -43,7 +43,7 @@ public function getOverviewRouteName() { * {@inheritdoc} */ public function getTypeLabel() { - $base_entity_info = $this->entityManager->getDefinition($this->pluginDefinition['base_entity_type']); + $base_entity_info = $this->entityTypeManager->getDefinition($this->pluginDefinition['base_entity_type']); return $this->t('@label fields', ['@label' => $base_entity_info->getLabel()]); } @@ -58,7 +58,7 @@ public function setEntity(ConfigEntityInterface $entity) { /** @var \Drupal\field\FieldStorageConfigInterface $field_storage */ $field_storage = $this->entity->getFieldStorageDefinition(); /** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */ - $entity_type_info = $this->entityManager->getDefinition($field_storage->getEntityTypeId()); + $entity_type_info = $this->entityTypeManager->getDefinition($field_storage->getEntityTypeId()); $this->addConfigName($entity_type_info->getConfigPrefix() . '.' . $field_storage->id()); return TRUE; }