diff --git a/core/modules/migrate/src/MigrationStorage.php b/core/modules/migrate/src/MigrationStorage.php index 0c92338..529535e 100644 --- a/core/modules/migrate/src/MigrationStorage.php +++ b/core/modules/migrate/src/MigrationStorage.php @@ -8,9 +8,15 @@ namespace Drupal\migrate; use Drupal\Component\Graph\Graph; +use Drupal\Component\Uuid\UuidInterface; +use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\Entity\ConfigEntityStorage; +use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Language\LanguageManagerInterface; use Drupal\migrate\Entity\MigrationInterface; use Drupal\migrate\Entity\MigrationGroupInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Storage for migration entities. @@ -18,6 +24,49 @@ class MigrationStorage extends ConfigEntityStorage implements MigrateBuildDependencyInterface { /** + * The migration group storage. + * + * @var \Drupal\Core\Entity\EntityInterface + */ + protected $migrationGroupStorage; + + /** + * Constructs a MigrationStorage object. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. + * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory + * The config factory service. + * @param \Drupal\Component\Uuid\UuidInterface $uuid_service + * The UUID service. + * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager + * The language manager. + * @param \Drupal\Core\Entity\EntityStorageInterface $migration_group_storage + * The migration group storage. + */ + public function __construct(EntityTypeInterface $entity_type, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityStorageInterface $migration_group_storage) { + parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager); + + $this->configFactory = $config_factory; + $this->uuidService = $uuid_service; + $this->languageManager = $language_manager; + $this->migrationGroupStorage = $migration_group_storage; + } + + /** + * {@inheritdoc} + */ + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + return new static( + $entity_type, + $container->get('config.factory'), + $container->get('uuid'), + $container->get('language_manager'), + $container->get('entity_manager')->getStorage('migration_group') + ); + } + + /** * {@inheritdoc} */ public function buildDependencyMigration(array $migrations, array $dynamic_ids) { @@ -103,7 +152,7 @@ protected function doLoadMultiple(array $ids = NULL) { // If we are pointing to a valid group, merge its properties into ours. if (isset($migration->migration_group)) { /** @var MigrationGroupInterface $group */ - $group = \Drupal::entityManager()->getStorage('migration_group')->load($migration->migration_group); + $group = $this->migrationGroupStorage->load($migration->migration_group); if ($group) { $shared_configuration = $group->get('shared_configuration'); if ($shared_configuration) {