3 namespace Drupal\migrate_drupal\Plugin\migrate\source;
5 use Drupal\Component\Plugin\DependentPluginInterface;
6 use Drupal\Core\Entity\DependencyTrait;
7 use Symfony\Component\DependencyInjection\ContainerInterface;
8 use Drupal\migrate\Plugin\MigrationInterface;
9 use Drupal\migrate\Plugin\migrate\source\EmptySource as BaseEmptySource;
10 use Drupal\Core\Entity\EntityManagerInterface;
11 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
14 * Source returning an empty row with Drupal specific config dependencies.
20 class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface {
27 * @var \Drupal\Core\Entity\EntityManagerInterface
29 protected $entityManager;
34 public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityManagerInterface $entity_manager) {
35 parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
36 $this->entityManager = $entity_manager;
42 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
48 $container->get('entity.manager')
55 public function calculateDependencies() {
56 // The empty source plugin supports the entity_type constant.
57 if (isset($this->configuration['constants']['entity_type'])) {
58 $this->addDependency('module', $this->entityManager->getDefinition($this->configuration['constants']['entity_type'])->getProvider());
60 return $this->dependencies;