function Row::setSourceProperty

Same name in other branches
  1. 8.9.x core/modules/migrate/src/Row.php \Drupal\migrate\Row::setSourceProperty()
  2. 10 core/modules/migrate/src/Row.php \Drupal\migrate\Row::setSourceProperty()
  3. 11.x core/modules/migrate/src/Row.php \Drupal\migrate\Row::setSourceProperty()

Sets a source property if the row is not frozen.

This can only be called from the source plugin.

Parameters

string $property: A property on the source.

mixed $data: The property value to set on the source.

Throws

\Exception

See also

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase::next

File

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

Class

Row
Stores a row.

Namespace

Drupal\migrate

Code

public function setSourceProperty($property, $data) {
    if ($this->frozen) {
        throw new \Exception("The source is frozen and can't be changed any more");
    }
    else {
        NestedArray::setValue($this->source, explode(static::PROPERTY_SEPARATOR, $property), $data, TRUE);
    }
}

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