protected function Entity::getEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Plugin/migrate/destination/Entity.php \Drupal\migrate\Plugin\migrate\destination\Entity::getEntity()
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're importing into.
6 calls to Entity::getEntity()
- EntityConfigBase::import in core/
modules/ migrate/ src/ Plugin/ migrate/ destination/ EntityConfigBase.php - Import the row.
- EntityContentBase::import in core/
modules/ migrate/ src/ Plugin/ migrate/ destination/ EntityContentBase.php - Import the row.
- EntityFile::getEntity in core/
modules/ file/ src/ Plugin/ migrate/ destination/ EntityFile.php - Creates or loads an entity.
- EntityImageStyle::import in core/
modules/ image/ src/ Plugin/ migrate/ destination/ EntityImageStyle.php - Import the row.
- EntityShortcutSet::getEntity in core/
modules/ shortcut/ src/ Plugin/ migrate/ destination/ EntityShortcutSet.php - Creates or loads an entity.
5 methods override Entity::getEntity()
- EntityFile::getEntity in core/
modules/ file/ src/ Plugin/ migrate/ destination/ EntityFile.php - Creates or loads an entity.
- EntityRevision::getEntity in core/
modules/ migrate/ src/ Plugin/ migrate/ destination/ EntityRevision.php - Get the entity.
- EntityShortcutSet::getEntity in core/
modules/ shortcut/ src/ Plugin/ migrate/ destination/ EntityShortcutSet.php - Creates or loads an entity.
- EntityTaxonomyTerm::getEntity in core/
modules/ taxonomy/ src/ Plugin/ migrate/ destination/ EntityTaxonomyTerm.php - Creates or loads an entity.
- EntityTestDestination::getEntity in core/
modules/ migrate/ tests/ src/ Unit/ Plugin/ migrate/ destination/ EntityContentBaseTest.php - Creates or loads an entity.
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ destination/ Entity.php, line 111 - Contains \Drupal\migrate\Plugin\migrate\destination\Entity.
Class
- Entity
- Plugin annotation @MigrateDestination( id = "entity", deriver = "Drupal\migrate\Plugin\Derivative\MigrateEntity" )
Namespace
Drupal\migrate\Plugin\migrate\destinationCode
protected function getEntity(Row $row, array $old_destination_id_values) {
$entity_id = $old_destination_id_values ? reset($old_destination_id_values) : $this
->getEntityId($row);
if (!empty($entity_id) && ($entity = $this->storage
->load($entity_id))) {
$this
->updateEntity($entity, $row);
}
else {
// Stubs might need some required fields filled in.
if ($row
->isStub()) {
$this
->processStubRow($row);
}
$entity = $this->storage
->create($row
->getDestination());
$entity
->enforceIsNew();
}
return $entity;
}