8.5.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.0.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.1.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.2.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.3.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.4.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)
8.6.x SourcePluginBase.php SourcePluginBase::__construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration)

Constructs a Drupal\Component\Plugin\PluginBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides PluginBase::__construct

3 methods override SourcePluginBase::__construct()
EmbeddedDataSource::__construct in core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php
Constructs a Drupal\Component\Plugin\PluginBase object.
EmptySource::__construct in core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php
Constructs a Drupal\Component\Plugin\PluginBase object.
SqlBase::__construct in core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
Constructs a Drupal\Component\Plugin\PluginBase object.

File

core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php, line 191

Class

SourcePluginBase
The base class for source plugins.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->migration = $migration;

  // Set up some defaults based on the source configuration.
  foreach ([
    'cacheCounts' => 'cache_counts',
    'skipCount' => 'skip_count',
    'trackChanges' => 'track_changes',
  ] as $property => $config_key) {
    if (isset($configuration[$config_key])) {
      $this->{$property} = (bool) $configuration[$config_key];
    }
  }
  $this->cacheKey = !empty($configuration['cache_key']) ? $configuration['cache_key'] : NULL;
  $this->idMap = $this->migration
    ->getIdMap();
  $this->highWaterProperty = !empty($configuration['high_water_property']) ? $configuration['high_water_property'] : FALSE;

  // Pull out the current highwater mark if we have a highwater property.
  if ($this->highWaterProperty) {
    $this->originalHighWater = $this
      ->getHighWater();
  }

  // Don't allow the use of both highwater and track changes together.
  if ($this->highWaterProperty && $this->trackChanges) {
    throw new MigrateException('You should either use a highwater mark or track changes not both. They are both designed to solve the same problem');
  }
}