You are here

public function Row::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Row.php \Drupal\migrate\Row::__construct()

Constructs a \Drupal\migrate\Row object.

Parameters

array $values: An array of values to add as properties on the object.

array $source_ids: An array containing the IDs of the source using the keys as the field names.

bool $is_stub: TRUE if the row being created is a stub.

Throws

\InvalidArgumentException Thrown when a source ID property does not exist.

File

core/modules/migrate/src/Row.php, line 101

Class

Row
Stores a row.

Namespace

Drupal\migrate

Code

public function __construct(array $values = [], array $source_ids = [], $is_stub = FALSE) {
  $this->source = $values;
  $this->sourceIds = $source_ids;
  $this->isStub = $is_stub;
  foreach (array_keys($source_ids) as $id) {
    if (!$this
      ->hasSourceProperty($id)) {
      throw new \InvalidArgumentException("'{$id}' is defined as a source ID but has no value.");
    }
  }
}