protected function GatherContentEntity::getEntity in GatherContent 8.5
Creates or loads an entity.
Parameters
\Drupal\migrate\Row $row: The row object.
array $old_destination_id_values: The old destination IDs.
Return value
\Drupal\Core\Entity\EntityInterface The entity we are importing into.
Overrides Entity::getEntity
File
- src/
Plugin/ migrate/ destination/ GatherContentEntity.php, line 89
Class
- GatherContentEntity
- Custom migrate entity.
Namespace
Drupal\gathercontent\Plugin\migrate\destinationCode
protected function getEntity(Row $row, array $old_destination_id_values) {
$entity = parent::getEntity($row, $old_destination_id_values);
$destination = $row
->getDestination();
// Create new revision according to the import options.
if (!empty($destination['gc_import_options']) && $entity
->getEntityType()
->isRevisionable() && !$entity
->isNew() && $destination['gc_import_options']['new_revision']) {
$entity
->setNewRevision(TRUE);
$entity
->setRevisionLogMessage('Created revision for entity ID: ' . $entity
->id());
$entity
->setRevisionCreationTime($this->time
->getRequestTime());
$entity
->setRevisionUserId($this->currentUser
->id());
}
return $entity;
}