getDestinationProperty($this->getKey('revision')); if (!empty($revision_id) && ($entity = $this->storage->loadRevision($revision_id))) { $entity->setNewRevision(FALSE); } else { $entity_id = $row->getDestinationProperty($this->getKey('id')); $entity = $this->storage->load($entity_id); // If we fail to load the original entity something is wrong and we need // to return immediately. if (!$entity) { return FALSE; } $entity->enforceIsNew(FALSE); $entity->setNewRevision(TRUE); } $this->updateEntity($entity, $row); $entity->isDefaultRevision(FALSE); return $entity; } /** * {@inheritdoc} */ protected function save(ContentEntityInterface $entity, array $old_destination_id_values = []) { $entity->save(); return [$entity->getRevisionId()]; } /** * {@inheritdoc} */ public function getIds() { if ($key = $this->getKey('revision')) { return [$key => $this->getDefinitionFromEntity($key)]; } throw new MigrateException('This entity type does not support revisions.'); } }