diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index c8b9eda..a229c82 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Config\Entity; use Drupal\Core\Entity\Entity; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Config\ConfigDuplicateUUIDException; @@ -37,8 +38,8 @@ /** * Overrides Entity::__construct(). */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); // Backup the original ID, if any. // Configuration entity IDs are strings, and '0' is a valid ID. diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 7fe3c49..fcafa78 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -10,6 +10,7 @@ use Drupal\Component\Uuid\Uuid; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityMalformedException; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageControllerBase; use Drupal\Core\Config\Config; use Drupal\Core\Config\ConfigFactory; @@ -76,6 +77,8 @@ class ConfigStorageController extends EntityStorageControllerBase { * The entity type for which the instance is created. * @param array $entity_info * An array of entity info for the entity type. + * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager plugin. * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory service. * @param \Drupal\Core\Config\StorageInterface $config_storage @@ -83,8 +86,8 @@ class ConfigStorageController extends EntityStorageControllerBase { * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query_factory * The entity query factory. */ - public function __construct($entity_type, array $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory) { - parent::__construct($entity_type, $entity_info); + public function __construct($entity_type, array $entity_info, EntityManager $entity_manager, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory) { + parent::__construct($entity_type, $entity_info, $entity_manager); $this->idKey = $this->entityInfo['entity_keys']['id']; @@ -107,6 +110,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $entity_type, $entity_info, + $container->get('plugin.manager.entity'), $container->get('config.factory'), $container->get('config.storage'), $container->get('entity.query') @@ -269,7 +273,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { // Load all of the configuration entities. $result = array(); foreach ($this->configFactory->loadMultiple($names) as $config) { - $result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType); + $result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType, $this->entityManager); } return $result; } @@ -316,7 +320,7 @@ public function create(array $values) { // Set default language to site default if not provided. $values += array('langcode' => language_default()->id); - $entity = new $class($values, $this->entityType); + $entity = new $class($values, $this->entityType, $this->entityManager); // Mark this entity as new, so isNew() returns TRUE. This does not check // whether a configuration entity with the same ID (if any) already exists. $entity->enforceIsNew(); diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index e2dc1b4..8bfb221 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -65,6 +65,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $entity_type, $entity_info, + $container->get('plugin.manager.entity'), $container->get('database') ); } @@ -78,9 +79,11 @@ public static function createInstance(ContainerInterface $container, $entity_typ * An array of entity info for the entity type. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. + * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager plugin. */ - public function __construct($entity_type, array $entity_info, Connection $database) { - parent::__construct($entity_type, $entity_info); + public function __construct($entity_type, array $entity_info, EntityManager $entity_manager, Connection $database) { + parent::__construct($entity_type, $entity_info, $entity_manager); $this->database = $database; @@ -143,7 +146,7 @@ public function loadMultiple(array $ids = NULL) { // We provide the necessary arguments for PDO to create objects of the // specified entity class. // @see Drupal\Core\Entity\EntityInterface::__construct() - $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['class'], array(array(), $this->entityType)); + $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['class'], array(array(), $this->entityType, $this->entityManager)); } $queried_entities = $query_result->fetchAllAssoc($this->idKey); } @@ -366,7 +369,7 @@ public function create(array $values) { $entity_class = $this->entityInfo['class']; $entity_class::preCreate($this, $values); - $entity = new $entity_class($values, $this->entityType); + $entity = new $entity_class($values, $this->entityType, $this->entityManager); // Assign a new UUID if there is none yet. if ($this->uuidKey && !isset($entity->{$this->uuidKey})) { diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php index 143a2ab..a3bb13e 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php @@ -53,8 +53,8 @@ class DatabaseStorageControllerNG extends DatabaseStorageController { /** * Overrides DatabaseStorageController::__construct(). */ - public function __construct($entity_type, array $entity_info, Connection $database) { - parent::__construct($entity_type,$entity_info, $database); + public function __construct($entity_type, array $entity_info, EntityManager $entity_manager, Connection $database) { + parent::__construct($entity_type, $entity_info, $entity_manager, $database); $this->bundleKey = !empty($this->entityInfo['entity_keys']['bundle']) ? $this->entityInfo['entity_keys']['bundle'] : FALSE; $this->entityClass = $this->entityInfo['class']; @@ -108,7 +108,7 @@ public function create(array $values) { } $bundle = $values[$this->bundleKey]; } - $entity = new $this->entityClass(array(), $this->entityType, $bundle); + $entity = new $this->entityClass(array(), $this->entityType, $this->entityManager, $bundle); foreach ($entity as $name => $field) { if (isset($values[$name])) { @@ -287,7 +287,7 @@ protected function attachPropertyData(array &$entities, $revision_id = FALSE) { } $data = $query->execute(); - $field_definition = \Drupal::entityManager()->getFieldDefinitions($this->entityType); + $field_definition = $this->entityManager->getFieldDefinitions($this->entityType); $translations = array(); if ($this->revisionTable) { $data_fields = array_flip(array_diff(drupal_schema_fields_sql($this->entityInfo['revision_table']), drupal_schema_fields_sql($this->entityInfo['base_table']))); diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index ec05c1a..499562d 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -39,6 +39,13 @@ class Entity implements IteratorAggregate, EntityInterface { protected $entityType; /** + * The entity manager. + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $entityManager; + + /** * Boolean indicating whether the entity should be forced to be new. * * @var bool @@ -68,8 +75,9 @@ class Entity implements IteratorAggregate, EntityInterface { * @param string $entity_type * The type of the entity to create. */ - public function __construct(array $values, $entity_type) { + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { $this->entityType = $entity_type; + $this->entityManager = $entity_manager; // Set initial values. foreach ($values as $key => $value) { $this->$key = $value; @@ -274,11 +282,11 @@ public function getIterator() { */ public function access($operation = 'view', AccountInterface $account = NULL) { if ($operation == 'create') { - return \Drupal::entityManager() + return $this->entityManager ->getAccessController($this->entityType) ->createAccess($this->bundle(), $account); } - return \Drupal::entityManager() + return $this->entityManager ->getAccessController($this->entityType) ->access($this, $operation, Language::LANGCODE_DEFAULT, $account); } @@ -354,7 +362,7 @@ public function getTranslationLanguages($include_default = TRUE) { * Implements \Drupal\Core\Entity\EntityInterface::save(). */ public function save() { - return \Drupal::entityManager()->getStorageController($this->entityType)->save($this); + return $this->entityManager->getStorageController($this->entityType)->save($this); } /** @@ -362,7 +370,7 @@ public function save() { */ public function delete() { if (!$this->isNew()) { - \Drupal::entityManager()->getStorageController($this->entityType)->delete(array($this->id() => $this)); + $this->entityManager->getStorageController($this->entityType)->delete(array($this->id() => $this)); } } @@ -386,7 +394,7 @@ public function createDuplicate() { * Implements \Drupal\Core\Entity\EntityInterface::entityInfo(). */ public function entityInfo() { - return \Drupal::entityManager()->getDefinition($this->entityType()); + return $this->entityManager->getDefinition($this->entityType()); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index 62b5bfb..616367f 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -137,8 +137,9 @@ class EntityNG extends Entity { /** * Overrides Entity::__construct(). */ - public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) { + public function __construct(array $values, $entity_type, EntityManager $entity_manager, $bundle = FALSE, $translations = array()) { $this->entityType = $entity_type; + $this->entityManager = $entity_manager; $this->bundle = $bundle ? $bundle : $this->entityType; $this->languages = language_list(Language::STATE_ALL); diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php index ea4e06c..19afd93 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php @@ -36,6 +36,13 @@ protected $entityType; /** + * The entity manager. + * + * @var \Drupal\Core\Entity\EntityManager + */ + protected $entityManager; + + /** * Array of information about the entity. * * @var array @@ -76,10 +83,13 @@ * The entity type for which the instance is created. * @param array $entity_info * An array of entity info for the entity type. + * @param EntityManager $entity_manager + * The entity manager plugin. */ - public function __construct($entity_type, $entity_info) { + public function __construct($entity_type, $entity_info, $entity_manager) { $this->entityType = $entity_type; $this->entityInfo = $entity_info; + $this->entityManager = $entity_manager; // Check if the entity type supports static caching of loaded entities. $this->cache = !empty($this->entityInfo['static_cache']); } @@ -151,7 +161,7 @@ public function invokeFieldMethod($method, EntityInterface $entity) { else { // For BC entities, iterate through fields and instantiate NG items // objects manually. - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); + $definitions = $this->entityManager->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { if (!empty($definition['configurable'])) { // Create the items object. @@ -203,7 +213,7 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { else { // For BC entities, iterate through the fields and instantiate NG items // objects manually. - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); + $definitions = $this->entityManager->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { if (!empty($definition['configurable'])) { $type_definition = \Drupal::typedData()->getDefinition($definition['type']); diff --git a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php index 1d3cca8..e77d1ae 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php @@ -12,6 +12,7 @@ use Drupal\Core\Annotation\Translation; use Drupal\block\BlockPluginBag; use Drupal\block\BlockInterface; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageControllerInterface; /** @@ -102,8 +103,8 @@ class Block extends ConfigEntityBase implements BlockInterface { /** * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::__construct(); */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $this->pluginBag = new BlockPluginBag(\Drupal::service('plugin.manager.block'), array($this->plugin), $this); } diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php index 4a34ce2..1563035 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php @@ -12,6 +12,7 @@ use Drupal\breakpoint\InvalidBreakpointSourceException; use Drupal\breakpoint\InvalidBreakpointSourceTypeException; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; /** @@ -96,8 +97,8 @@ class BreakpointGroup extends ConfigEntityBase implements BreakpointGroupInterfa /** * Overrides Drupal\config\ConfigEntityBase::__construct(). */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $this->loadAllBreakpoints(); } diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php index 710b991..e516a48 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/Core/Entity/Editor.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\editor\EditorInterface; @@ -71,8 +72,8 @@ public function label($langcode = NULL) { /** * Overrides Drupal\Core\Entity\Entity::__construct() */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $manager = \Drupal::service('plugin.manager.editor'); $plugin = $manager->createInstance($this->editor); diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 99008e2..8438161 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -8,6 +8,7 @@ namespace Drupal\entity; use Drupal\Core\Config\Entity\ConfigEntityBase; +use Drupal\Core\Entity\EntityManager; /** * Base class for config entity types that store configuration for entity forms @@ -89,7 +90,7 @@ /** * {@inheritdoc} */ - public function __construct(array $values, $entity_type) { + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { // @todo See http://drupal.org/node/1825044#comment-6847792: contact.module // currently produces invalid entities with a NULL bundle in some cases. // Add the validity checks back when http://drupal.org/node/1856556 is @@ -106,7 +107,7 @@ public function __construct(array $values, $entity_type) { throw new \RuntimeException('Missing display context type.'); } - parent::__construct($values, $entity_type); + parent::__construct($values, $entity_type, $entity_manager); $this->originalMode = $this->mode; } diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php index 78963bc..9b258c8 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityDisplay.php @@ -8,6 +8,7 @@ namespace Drupal\entity\Plugin\Core\Entity; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\entity\EntityDisplayBase; use Drupal\entity\EntityDisplayInterface; @@ -35,11 +36,11 @@ class EntityDisplay extends EntityDisplayBase implements EntityDisplayInterface /** * {@inheritdoc} */ - public function __construct(array $values, $entity_type) { + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { $this->pluginManager = \Drupal::service('plugin.manager.field.formatter'); $this->displayContext = 'display'; - parent::__construct($values, $entity_type); + parent::__construct($values, $entity_type, $entity_manager); } /** diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormDisplay.php b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormDisplay.php index 9a3f0a6..133fc46 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Core/Entity/EntityFormDisplay.php @@ -8,6 +8,7 @@ namespace Drupal\entity\Plugin\Core\Entity; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\entity\EntityDisplayBase; use Drupal\entity\EntityFormDisplayInterface; @@ -35,11 +36,11 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn /** * {@inheritdoc} */ - public function __construct(array $values, $entity_type) { + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { $this->pluginManager = \Drupal::service('plugin.manager.field.widget'); $this->displayContext = 'form'; - parent::__construct($values, $entity_type); + parent::__construct($values, $entity_type, $entity_manager); } /** diff --git a/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php b/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php index f9ce249..fc3743e 100644 --- a/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php +++ b/core/modules/field/lib/Drupal/field/FieldInstanceStorageController.php @@ -67,7 +67,7 @@ class FieldInstanceStorageController extends ConfigStorageController { * The state key value store. */ public function __construct($entity_type, array $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, EntityManager $entity_manager, ModuleHandler $module_handler, KeyValueStoreInterface $state) { - parent::__construct($entity_type, $entity_info, $config_factory, $config_storage, $entity_query_factory); + parent::__construct($entity_type, $entity_info, $entity_manager, $config_factory, $config_storage, $entity_query_factory); $this->entityManager = $entity_manager; $this->moduleHandler = $module_handler; $this->state = $state; diff --git a/core/modules/field/lib/Drupal/field/FieldStorageController.php b/core/modules/field/lib/Drupal/field/FieldStorageController.php index 41efe60..b6a3b8c 100644 --- a/core/modules/field/lib/Drupal/field/FieldStorageController.php +++ b/core/modules/field/lib/Drupal/field/FieldStorageController.php @@ -62,7 +62,7 @@ class FieldStorageController extends ConfigStorageController { * The state key value store. */ public function __construct($entity_type, array $entity_info, ConfigFactory $config_factory, StorageInterface $config_storage, QueryFactory $entity_query_factory, EntityManager $entity_manager, ModuleHandler $module_handler, KeyValueStoreInterface $state) { - parent::__construct($entity_type, $entity_info, $config_factory, $config_storage, $entity_query_factory); + parent::__construct($entity_type, $entity_info, $entity_manager, $config_factory, $config_storage, $entity_query_factory); $this->entityManager = $entity_manager; $this->moduleHandler = $module_handler; diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php index 1bb1ae4..61f5586 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/Field.php @@ -8,6 +8,7 @@ namespace Drupal\field\Plugin\Core\Entity; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\field\FieldException; @@ -234,7 +235,7 @@ class Field extends ConfigEntityBase implements FieldInterface { * * @ingroup field_crud */ - public function __construct(array $values, $entity_type = 'field_entity') { + public function __construct(array $values, $entity_type = 'field_entity', EntityManager $entity_manager) { // Check required properties. if (empty($values['type'])) { throw new FieldException('Attempt to create a field with no type.'); @@ -253,7 +254,7 @@ public function __construct(array $values, $entity_type = 'field_entity') { throw new FieldException('Attempt to create a field with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character'); } - parent::__construct($values, $entity_type); + parent::__construct($values, $entity_type, $entity_manager); } /** diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php index cbfb636..3ca377a 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php @@ -8,6 +8,7 @@ namespace Drupal\field\Plugin\Core\Entity; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\field\FieldException; @@ -231,7 +232,7 @@ class FieldInstance extends ConfigEntityBase implements FieldInstanceInterface { * * @ingroup field_crud */ - public function __construct(array $values, $entity_type = 'field_instance') { + public function __construct(array $values, $entity_type = 'field_instance', EntityManager $entity_manager) { // Accept incoming 'field_name' instead of 'field_uuid', for easier DX on // creation of new instances. if (isset($values['field_name']) && !isset($values['field_uuid'])) { @@ -277,7 +278,7 @@ public function __construct(array $values, $entity_type = 'field_instance') { $values += array( 'label' => $this->field->id, ); - parent::__construct($values, $entity_type); + parent::__construct($values, $entity_type, $entity_manager); } /** diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php index 43d54ce..9c60cce 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\DatabaseStorageController; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Database\Connection; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -55,8 +56,8 @@ class MenuLinkStorageController extends DatabaseStorageController implements Men * @param \Symfony\Cmf\Component\Routing\RouteProviderInterface $route_provider * The route provider service. */ - public function __construct($entity_type, array $entity_info, Connection $database, RouteProviderInterface $route_provider) { - parent::__construct($entity_type, $entity_info, $database); + public function __construct($entity_type, array $entity_info, EntityManager $entity_manager, Connection $database, RouteProviderInterface $route_provider) { + parent::__construct($entity_type, $entity_info, $entity_manager, $database); $this->routeProvider = $route_provider; @@ -84,6 +85,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $entity_type, $entity_info, + $container->get('plugin.manager.entity'), $container->get('database'), $container->get('router.route_provider') ); diff --git a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php index e10f86f..ea120bc 100644 --- a/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Plugin/Core/Entity/PictureMapping.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\picture\PictureMappingInterface; @@ -79,8 +80,8 @@ class PictureMapping extends ConfigEntityBase implements PictureMappingInterface /** * Overrides Drupal\config\ConfigEntityBase::__construct(). */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $this->loadBreakpointGroup(); $this->loadAllMappings(); } diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php index fe8f537..bf7f988 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\system\ActionConfigEntityInterface; @@ -88,8 +89,8 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface { /** * {@inheritdoc} */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $this->pluginBag = new ActionBag(\Drupal::service('plugin.manager.action'), array($this->plugin), $this->configuration); } diff --git a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php index 4b8ac15..2beb08c 100644 --- a/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php +++ b/core/modules/tour/lib/Drupal/tour/Plugin/Core/Entity/Tour.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Annotation\Translation; use Drupal\tour\TipsBag; use Drupal\tour\TourInterface; @@ -79,8 +80,8 @@ class Tour extends ConfigEntityBase implements TourInterface { /** * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::__construct(); */ - public function __construct(array $values, $entity_type) { - parent::__construct($values, $entity_type); + public function __construct(array $values, $entity_type, EntityManager $entity_manager) { + parent::__construct($values, $entity_type, $entity_manager); $this->tipsBag = new TipsBag(\Drupal::service('plugin.manager.tour.tip'), $this->tips); } diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php index 05961e1..1e44ad7 100644 --- a/core/modules/user/lib/Drupal/user/UserStorageController.php +++ b/core/modules/user/lib/Drupal/user/UserStorageController.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityBCDecorator; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityManager; use Drupal\Core\Password\PasswordInterface; use Drupal\Core\Database\Connection; use Drupal\user\UserDataInterface; @@ -51,8 +52,8 @@ class UserStorageController extends DatabaseStorageControllerNG implements UserS * @param \Drupal\user\UserDataInterface $user_data * The user data service. */ - public function __construct($entity_type, $entity_info, Connection $database, PasswordInterface $password, UserDataInterface $user_data) { - parent::__construct($entity_type, $entity_info, $database); + public function __construct($entity_type, $entity_info, EntityManager $entity_manager, Connection $database, PasswordInterface $password, UserDataInterface $user_data) { + parent::__construct($entity_type, $entity_info, $entity_manager, $database); $this->password = $password; $this->userData = $user_data; @@ -65,6 +66,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $entity_type, $entity_info, + $container->get('plugin.manager.entity'), $container->get('database'), $container->get('password'), $container->get('user.data')