Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 16 |
| EmptySource | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 16 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| create | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 8 |
|||
| calculateDependencies | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource. | |
| */ | |
| namespace Drupal\migrate_drupal\Plugin\migrate\source; | |
| use Drupal\Component\Plugin\DependentPluginInterface; | |
| use Drupal\Core\Entity\DependencyTrait; | |
| use Symfony\Component\DependencyInjection\ContainerInterface; | |
| use Drupal\migrate\Entity\MigrationInterface; | |
| use Drupal\migrate\Plugin\migrate\source\EmptySource as BaseEmptySource; | |
| use Drupal\Core\Entity\EntityManagerInterface; | |
| use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
| /** | |
| * Source returning an empty row with Drupal specific config dependencies. | |
| * | |
| * @MigrateSource( | |
| * id = "md_empty" | |
| * ) | |
| */ | |
| class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface { | |
| use DependencyTrait; | |
| /** | |
| * The entity manager. | |
| * | |
| * @var \Drupal\Core\Entity\EntityManagerInterface | |
| */ | |
| protected $entityManager; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityManagerInterface $entity_manager) { | |
| parent::__construct($configuration, $plugin_id, $plugin_definition, $migration); | |
| $this->entityManager = $entity_manager; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { | |
| return new static( | |
| $configuration, | |
| $plugin_id, | |
| $plugin_definition, | |
| $migration, | |
| $container->get('entity.manager') | |
| ); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function calculateDependencies() { | |
| // The empty source plugin supports the entity_type constant. | |
| if (isset($this->configuration['constants']['entity_type'])) { | |
| $this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider()); | |
| } | |
| return $this->dependencies; | |
| } | |
| } |