DrupalSqlBase.php 1.41 KB
Newer Older
1 2 3 4
<?php

namespace Drupal\paragraphs\Plugin\migrate\source;

5
use Drupal\Component\Plugin\ConfigurableInterface;
6 7
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase as MigrateDrupalSqlBase;
use Drupal\Component\Utility\NestedArray;
8
use Drupal\Core\Entity\EntityTypeManagerInterface;
9 10 11 12 13 14 15 16 17
use Drupal\Core\State\StateInterface;
use Drupal\migrate\Plugin\MigrationInterface;

/**
 * Base Class for Paragraphs DrupalSqlBase migrate source plugins.
 *
 * Add and implement Configurable Plugin interface to
 * Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase.
 */
18
abstract class DrupalSqlBase extends MigrateDrupalSqlBase implements ConfigurableInterface {
19 20 21 22

  /**
   * {@inheritdoc}
   */
23 24
  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_type_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_type_manager);
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    $this->setConfiguration($configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return $this->configuration;
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {
    $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [];
  }

}