Issue #2124537 by chx: Nuke the Eldritch Abomination EntityManager::addNamespaces.
parent
fa32679489
commit
97fc3d3160
|
@ -137,27 +137,12 @@ class EntityManager extends PluginManagerBase implements EntityManagerInterface
|
|||
$this->namespaces = $namespaces;
|
||||
$this->translationManager = $translation_manager;
|
||||
|
||||
$this->doDiscovery($namespaces);
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
protected function doDiscovery($namespaces) {
|
||||
$this->discovery = new AnnotatedClassDiscovery('Entity', $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:' . $this->languageManager->getLanguage(Language::TYPE_INTERFACE)->id, 'cache', CacheBackendInterface::CACHE_PERMANENT, array('entity_info' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addNamespaces(\Traversable $namespaces) {
|
||||
reset($this->namespaces);
|
||||
$iterator = new \AppendIterator;
|
||||
$iterator->append(new \IteratorIterator($this->namespaces));
|
||||
$iterator->append($namespaces);
|
||||
$this->doDiscovery($iterator);
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -138,20 +138,6 @@ interface EntityManagerInterface extends PluginManagerInterface {
|
|||
*/
|
||||
public function getAllBundleInfo();
|
||||
|
||||
/**
|
||||
* Add more namespaces to the entity manager.
|
||||
*
|
||||
* This is usually only necessary for uninstall purposes.
|
||||
*
|
||||
* @todo Remove this method, along with doDiscovery(), when
|
||||
* https://drupal.org/node/1199946 is fixed.
|
||||
*
|
||||
* @param \Traversable $namespaces
|
||||
*
|
||||
* @see comment_uninstall()
|
||||
*/
|
||||
public function addNamespaces(\Traversable $namespaces);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue