function SourcePluginBase::__construct
Same name in other branches
- 9 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::__construct()
- 8.9.x core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::__construct()
- 10 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::__construct()
2 calls to SourcePluginBase::__construct()
- EmbeddedDataSource::__construct in core/
modules/ migrate/ src/ Plugin/ migrate/ source/ EmbeddedDataSource.php - SqlBase::__construct in core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SqlBase.php
4 methods override SourcePluginBase::__construct()
- ContentEntity::__construct in core/
modules/ migrate_drupal/ src/ Plugin/ migrate/ source/ ContentEntity.php - EmbeddedDataSource::__construct in core/
modules/ migrate/ src/ Plugin/ migrate/ source/ EmbeddedDataSource.php - EmptySource::__construct in core/
modules/ migrate_drupal/ src/ Plugin/ migrate/ source/ EmptySource.php - SqlBase::__construct in core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SqlBase.php
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SourcePluginBase.php, line 241
Class
- SourcePluginBase
- The base class for source plugins.
Namespace
Drupal\migrate\Plugin\migrate\sourceCode
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];
}
}
if ($this->cacheCounts) {
$this->cacheKey = $configuration['cache_key'] ?? $plugin_id . '-' . hash('sha256', Json::encode($configuration));
}
$this->idMap = $this->migration
->getIdMap();
$this->highWaterProperty = !empty($configuration['high_water_property']) ? $configuration['high_water_property'] : FALSE;
// Pull out the current high-water mark if we have a high-water property.
if ($this->highWaterProperty) {
$this->originalHighWater = $this->getHighWater();
}
// Don't allow the use of both high water and track changes together.
if ($this->highWaterProperty && $this->trackChanges) {
throw new MigrateException('You should either use a high-water mark or track changes not both. They are both designed to solve the same problem');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.