You are here

public function SourcePluginBase::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::__construct()

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 calls to 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.
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 130
Contains \Drupal\migrate\Plugin\migrate\source\SourcePluginBase.

Class

SourcePluginBase
The base class for all 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.
  $this->cacheCounts = !empty($configuration['cache_counts']);
  $this->skipCount = !empty($configuration['skip_count']);
  $this->cacheKey = !empty($configuration['cache_key']) ? !empty($configuration['cache_key']) : NULL;
  $this->trackChanges = !empty($configuration['track_changes']) ? $configuration['track_changes'] : FALSE;
  $this->idMap = $this->migration
    ->getIdMap();

  // Pull out the current highwater mark if we have a highwater property.
  if ($this->highWaterProperty = $this->migration
    ->get('highWaterProperty')) {
    $this->originalHighWater = $this->migration
      ->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');
  }
}