Example #1
0
 /**
  * {@inheritdoc}
  */
 public function loadMultiple(array $ids = NULL)
 {
     /** @var \Drupal\migrate\Entity\MigrationInterface[] $migrations */
     $migrations = parent::loadMultiple($ids);
     foreach ($migrations as $migration) {
         $migration->set('migration_dependencies', $this->expandDependencies($migration->getMigrationDependencies()));
     }
     return $migrations;
 }
 /**
  * @covers ::loadMultiple()
  * @covers ::postLoad()
  * @covers ::mapFromStorageRecords()
  * @covers ::doLoadMultiple()
  */
 public function testLoadMultipleIds()
 {
     $config_object = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->getMock();
     $config_object->expects($this->exactly(2))->method('get')->will($this->returnValueMap(array(array('', array('id' => 'foo')), array('id', 'foo'))));
     $this->configFactory->expects($this->once())->method('loadMultiple')->with(array('the_config_prefix.foo'))->will($this->returnValue(array($config_object)));
     $this->moduleHandler->expects($this->exactly(2))->method('getImplementations')->will($this->returnValue(array()));
     $entities = $this->entityStorage->loadMultiple(array('foo'));
     foreach ($entities as $id => $entity) {
         $this->assertInstanceOf('Drupal\\Core\\Entity\\EntityInterface', $entity);
         $this->assertSame($id, $entity->id());
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function loadMultiple(array $ids = NULL)
 {
     if ($ids) {
         $ids = $this->getVariantIds($ids);
     }
     /** @var \Drupal\migrate\Entity\MigrationInterface[] $migrations */
     $migrations = parent::loadMultiple($ids);
     foreach ($migrations as $migration) {
         $dependencies = array_map([$this, 'getVariantIds'], $migration->getMigrationDependencies());
         $migration->set('migration_dependencies', $dependencies);
     }
     // Build an array of dependencies and set the order of the migrations.
     return $this->buildDependencyMigration($migrations, []);
 }