Created
September 14, 2016 19:02
-
-
Save heddn/7a7bad21e703bc88e566ea781ef27ddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\paragraphs\Plugin\migrate\destination; | |
use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; | |
use Drupal\Core\Entity\ContentEntityInterface; | |
/** | |
* @MigrateDestination( | |
* id = "entity:paragraph" | |
* ) | |
*/ | |
class Paragraph extends EntityContentBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
protected function save(ContentEntityInterface $entity, array $old_destination_id_values = array()) { | |
$entity->save(); | |
return [ | |
'target_id' => $entity->id(), | |
'target_revision_id' => $entity->getRevisionId(), | |
]; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getIds() { | |
$ids = parent::getIds(); | |
$revision_key = $this->getKey('revision'); | |
$ids[$revision_key]['type'] = 'string'; | |
return $ids; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment