You are here

public function EntityViewsData::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::__construct()

Constructs an EntityViewsData object.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to provide views integration for.

\Drupal\Core\Entity\Sql\SqlEntityStorageInterface $storage_controller: The storage handler used for this entity type.

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

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\StringTranslation\TranslationInterface $translation_manager: The translation manager.

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

File

core/modules/views/src/EntityViewsData.php, line 98

Class

EntityViewsData
Provides generic views integration for entities.

Namespace

Drupal\views

Code

public function __construct(EntityTypeInterface $entity_type, SqlEntityStorageInterface $storage_controller, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, TranslationInterface $translation_manager, EntityFieldManagerInterface $entity_field_manager = NULL) {
  $this->entityType = $entity_type;
  $this->entityTypeManager = $entity_type_manager;
  $this->storage = $storage_controller;
  $this->moduleHandler = $module_handler;
  $this
    ->setStringTranslation($translation_manager);
  if (!$entity_field_manager) {
    @trigger_error('Calling EntityViewsData::__construct() with the $entity_field_manager argument is supported in drupal:8.8.0 and will be required before drupal:9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $entity_field_manager = \Drupal::service('entity_field.manager');
  }
  $this->entityFieldManager = $entity_field_manager;
}