public function EntityRepository::__construct in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityRepository.php \Drupal\Core\Entity\EntityRepository::__construct()
Constructs a new EntityRepository.
Parameters
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.
\Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository: The context repository service.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityRepository.php, line 47
Class
- EntityRepository
- Provides several mechanisms for retrieving entities.
Namespace
Drupal\Core\EntityCode
public function __construct(EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, ContextRepositoryInterface $context_repository = NULL) {
$this->entityTypeManager = $entity_type_manager;
$this->languageManager = $language_manager;
if (isset($context_repository)) {
$this->contextRepository = $context_repository;
}
else {
@trigger_error('The context.repository service must be passed to EntityRepository::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2938929.', E_USER_DEPRECATED);
$this->contextRepository = \Drupal::service('context.repository');
}
}