function Row::__construct

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Row.php \Drupal\migrate\Row::__construct()
  2. 8.9.x core/modules/migrate/src/Row.php \Drupal\migrate\Row::__construct()
  3. 11.x 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.");
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.