public function EntityManager::__construct

Constructs a new Entity plugin manager.

Parameters

\Traversable $namespaces: An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations,

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this object should use.

File

drupal/core/lib/Drupal/Core/Entity/EntityManager.php, line 59
Contains \Drupal\Core\Entity\EntityManager.

Class

EntityManager
Manages entity type plugin definitions.

Namespace

Drupal\Core\Entity

Code

public function __construct(\Traversable $namespaces, ContainerInterface $container) {

  // Allow the plugin definition to be altered by hook_entity_info_alter().
  $annotation_namespaces = array(
    'Drupal\\Core\\Entity\\Annotation' => DRUPAL_ROOT . '/core/lib',
  );
  $this->discovery = new AnnotatedClassDiscovery('Core/Entity', $namespaces, $annotation_namespaces, 'Drupal\\Core\\Entity\\Annotation\\EntityType');
  $this->discovery = new InfoHookDecorator($this->discovery, 'entity_info');
  $this->discovery = new AlterDecorator($this->discovery, 'entity_info');
  $this->discovery = new CacheDecorator($this->discovery, 'entity_info:' . language(Language::TYPE_INTERFACE)->langcode, 'cache', CacheBackendInterface::CACHE_PERMANENT, array(
    'entity_info' => TRUE,
  ));
  $this->factory = new DefaultFactory($this->discovery);
  $this->container = $container;
}