You are here

public function EntityDefinitionUpdateManager::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::__construct()
  2. 10 core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::__construct()

Constructs a new EntityDefinitionUpdateManager.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.

\Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository: The last installed schema repository service.

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager service.

\Drupal\Core\Entity\EntityTypeListenerInterface $entity_type_listener: The entity type listener interface.

\Drupal\Core\Field\FieldStorageDefinitionListenerInterface $field_storage_definition_listener: The field storage definition listener service.

File

core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php, line 74

Class

EntityDefinitionUpdateManager
Manages entity definition updates.

Namespace

Drupal\Core\Entity

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityLastInstalledSchemaRepositoryInterface $entity_last_installed_schema_repository = NULL, EntityFieldManagerInterface $entity_field_manager = NULL, EntityTypeListenerInterface $entity_type_listener = NULL, FieldStorageDefinitionListenerInterface $field_storage_definition_listener = NULL) {
  if ($entity_type_manager instanceof EntityManagerInterface) {
    @trigger_error('Passing the entity.manager service to EntityDefinitionUpdateManager::__construct() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Pass the new dependencies instead. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityTypeManager = \Drupal::entityTypeManager();
  }
  else {
    $this->entityTypeManager = $entity_type_manager;
  }
  if ($entity_last_installed_schema_repository) {
    $this->entityLastInstalledSchemaRepository = $entity_last_installed_schema_repository;
  }
  else {
    @trigger_error('The entity.last_installed_schema.repository service must be passed to EntityDefinitionUpdateManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityLastInstalledSchemaRepository = \Drupal::service('entity.last_installed_schema.repository');
  }
  if ($entity_field_manager) {
    $this->entityFieldManager = $entity_field_manager;
  }
  else {
    @trigger_error('The entity_field.manager service must be passed to EntityDefinitionUpdateManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityFieldManager = \Drupal::service('entity_field.manager');
  }
  if ($entity_type_listener) {
    $this->entityTypeListener = $entity_type_listener;
  }
  else {
    @trigger_error('The entity_type.listener service must be passed to EntityDefinitionUpdateManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->entityTypeListener = \Drupal::service('entity_type.listener');
  }
  if ($field_storage_definition_listener) {
    $this->fieldStorageDefinitionListener = $field_storage_definition_listener;
  }
  else {
    @trigger_error('The field_storage_definition.listener service must be passed to EntityDefinitionUpdateManager::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $this->fieldStorageDefinitionListener = \Drupal::service('field_storage_definition.listener');
  }
}