You are here

public function EckEntity::__construct in Entity Construction Kit (ECK) 8

Same name in this branch
  1. 8 src/Entity/EckEntity.php \Drupal\eck\Entity\EckEntity::__construct()
  2. 8 src/Plugin/migrate/source/d7/EckEntity.php \Drupal\eck\Plugin\migrate\source\d7\EckEntity::__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 DrupalSqlBase::__construct

File

src/Plugin/migrate/source/d7/EckEntity.php, line 58

Class

EckEntity
Drupal 7 ECK Entity source from database.

Namespace

Drupal\eck\Plugin\migrate\source\d7

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_manager) {
  $this->entityType = $configuration['entity_type'] ?? '';
  if (!\is_string($this->entityType)) {
    throw new MigrateException('The entity_type must be a string');
  }
  if (isset($configuration['bundle'])) {
    $this->bundle = $configuration['bundle'];
    if (!\is_string($this->bundle) && !\is_array($this->bundle)) {
      throw new MigrateException('The bundle must be a string or an array');
    }
  }
  $this->eckTable = 'eck_' . $this->entityType;
  parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
}