Loading core/modules/migrate/src/Plugin/migrate/destination/Entity.php +30 −0 Changes for core/modules/migrate/src/Plugin/migrate/destination/Entity.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\DependencyTrait; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\migrate\EntityFieldDefinitionTrait; Loading Loading @@ -181,6 +182,35 @@ protected function getEntity(Row $row, array $old_destination_id_values) { return $entity; } /** * Updates an entity with the new values from row. * * This method should be implemented in extending classes. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * * @throws \LogicException * Thrown for config entities, if the destination is for translations and * either the "property" or "translation" property does not exist. */ abstract protected function updateEntity(EntityInterface $entity, Row $row); /** * Populates as much of the stub row as possible. * * This method can be implemented in extending classes when needed. * * @param \Drupal\migrate\Row $row * The row of data. */ protected function processStubRow(Row $row) {} /** * Gets the entity ID of the row. * Loading core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php +5 −0 Changes for core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -193,6 +193,9 @@ public function getIds() { * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * * @throws \LogicException * Thrown if the destination is for translations and either the "property" * or "translation" property does not exist. Loading Loading @@ -226,6 +229,8 @@ protected function updateEntity(EntityInterface $entity, Row $row) { } $this->setRollbackAction($row->getIdMap()); } return $entity; } /** Loading core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +2 −13 Changes for core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php: 2 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -266,15 +266,7 @@ public function getIds() { } /** * Updates an entity with the new values from row. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * {@inheritdoc} */ protected function updateEntity(EntityInterface $entity, Row $row) { $empty_destinations = $row->getEmptyDestinationProperties(); Loading Loading @@ -325,10 +317,7 @@ protected function updateEntity(EntityInterface $entity, Row $row) { } /** * Populates as much of the stub row as possible. * * @param \Drupal\migrate\Row $row * The row of data. * {@inheritdoc} */ protected function processStubRow(Row $row) { $bundle_key = $this->getKey('bundle'); Loading core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +8 −0 Changes for core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -242,6 +242,14 @@ public function save(ContentEntityInterface $entity, array $old_destination_id_v * This method is from the parent and we aren't concerned with the inner * workings of its implementation which would trickle into mock assertions. An * empty implementation avoids this. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. */ protected function updateEntity(EntityInterface $entity, Row $row) { return $entity; Loading core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php +2 −6 Changes for core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php: 2 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -90,12 +90,7 @@ public function import(Row $row, array $old_destination_id_values = []) { } /** * Updates the entity with the contents of a row. * * @param \Drupal\Core\Entity\EntityInterface $entity * The search page entity. * @param \Drupal\migrate\Row $row * The row object to update from. * {@inheritdoc} */ protected function updateEntity(EntityInterface $entity, Row $row) { parent::updateEntity($entity, $row); Loading @@ -105,6 +100,7 @@ protected function updateEntity(EntityInterface $entity, Row $row) { if ($plugin instanceof ConfigurableSearchPluginBase) { $plugin->setConfiguration($row->getDestinationProperty('configuration')); } return $entity; } } Loading
core/modules/migrate/src/Plugin/migrate/destination/Entity.php +30 −0 Changes for core/modules/migrate/src/Plugin/migrate/destination/Entity.php: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\DependencyTrait; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\migrate\EntityFieldDefinitionTrait; Loading Loading @@ -181,6 +182,35 @@ protected function getEntity(Row $row, array $old_destination_id_values) { return $entity; } /** * Updates an entity with the new values from row. * * This method should be implemented in extending classes. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * * @throws \LogicException * Thrown for config entities, if the destination is for translations and * either the "property" or "translation" property does not exist. */ abstract protected function updateEntity(EntityInterface $entity, Row $row); /** * Populates as much of the stub row as possible. * * This method can be implemented in extending classes when needed. * * @param \Drupal\migrate\Row $row * The row of data. */ protected function processStubRow(Row $row) {} /** * Gets the entity ID of the row. * Loading
core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php +5 −0 Changes for core/modules/migrate/src/Plugin/migrate/destination/EntityConfigBase.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -193,6 +193,9 @@ public function getIds() { * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * * @throws \LogicException * Thrown if the destination is for translations and either the "property" * or "translation" property does not exist. Loading Loading @@ -226,6 +229,8 @@ protected function updateEntity(EntityInterface $entity, Row $row) { } $this->setRollbackAction($row->getIdMap()); } return $entity; } /** Loading
core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +2 −13 Changes for core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php: 2 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -266,15 +266,7 @@ public function getIds() { } /** * Updates an entity with the new values from row. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. * {@inheritdoc} */ protected function updateEntity(EntityInterface $entity, Row $row) { $empty_destinations = $row->getEmptyDestinationProperties(); Loading Loading @@ -325,10 +317,7 @@ protected function updateEntity(EntityInterface $entity, Row $row) { } /** * Populates as much of the stub row as possible. * * @param \Drupal\migrate\Row $row * The row of data. * {@inheritdoc} */ protected function processStubRow(Row $row) { $bundle_key = $this->getKey('bundle'); Loading
core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php +8 −0 Changes for core/modules/migrate/tests/src/Unit/destination/EntityRevisionTest.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -242,6 +242,14 @@ public function save(ContentEntityInterface $entity, array $old_destination_id_v * This method is from the parent and we aren't concerned with the inner * workings of its implementation which would trickle into mock assertions. An * empty implementation avoids this. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity to update. * @param \Drupal\migrate\Row $row * The row object to update from. * * @return \Drupal\Core\Entity\EntityInterface * An updated entity from row values. */ protected function updateEntity(EntityInterface $entity, Row $row) { return $entity; Loading
core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php +2 −6 Changes for core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php: 2 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -90,12 +90,7 @@ public function import(Row $row, array $old_destination_id_values = []) { } /** * Updates the entity with the contents of a row. * * @param \Drupal\Core\Entity\EntityInterface $entity * The search page entity. * @param \Drupal\migrate\Row $row * The row object to update from. * {@inheritdoc} */ protected function updateEntity(EntityInterface $entity, Row $row) { parent::updateEntity($entity, $row); Loading @@ -105,6 +100,7 @@ protected function updateEntity(EntityInterface $entity, Row $row) { if ($plugin instanceof ConfigurableSearchPluginBase) { $plugin->setConfiguration($row->getDestinationProperty('configuration')); } return $entity; } }