diff --git a/core/modules/migrate/src/Exception/MigrateEntityViolationException.php b/core/modules/migrate/src/Exception/MigrateEntityViolationException.php index 10c83ce..60de673 100644 --- a/core/modules/migrate/src/Exception/MigrateEntityViolationException.php +++ b/core/modules/migrate/src/Exception/MigrateEntityViolationException.php @@ -17,24 +17,15 @@ class MigrateEntityViolationException extends MigrateException { * * @param \Drupal\Core\Entity\EntityConstraintViolationListInterface $violations * The violations for the exception. - * @param int $code - * The Exception code. - * @param \Exception $previous - * The previous exception used for the exception chaining. - * @param int $level - * The level of the error, a Migration::MESSAGE_* constant. - * @param int $status - * The status of the item for the map table, a MigrateMap::STATUS_* - * constant. */ - public function __construct(EntityConstraintViolationListInterface $violations, $code = 0, \Exception $previous = NULL, $level = MigrationInterface::MESSAGE_ERROR, $status = MigrateIdMapInterface::STATUS_FAILED) { + public function __construct(EntityConstraintViolationListInterface $violations) { $messages = []; foreach ($violations as $violation) { /** @var \Symfony\Component\Validator\ConstraintViolationInterface $violation */ - $messages[] = $violation->getMessage(); + $messages[] = $violation->getRoot() . ' : ' . $violation->getPropertyPath() . ' : ' . $violation->getMessage(); } - parent::__construct(implode(', ', $messages), $code, $previous, $level, $status); + parent::__construct(implode(', ', $messages)); } } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index 302e9b7..e9be436 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -100,23 +100,25 @@ public function import(Row $row, array $old_destination_id_values = array()) { * * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The content entity. + * @param array $old_destination_id_values + * (optional) An array of destination ID values. Defaults to an empty array. * * @return array * An array containing the entity ID. */ - protected function save(ContentEntityInterface $entity) { + protected function save(ContentEntityInterface $entity, array $old_destination_id_values = array()) { if ($this->needsValidation()) { $this->validateEntity($entity); } $entity->save(); - return [$entity->id()]; + return array($entity->id()); } /** * Whether or not the entity needs validation. * * @return bool - * True if validation is needed, false otherwise. + * TRUE if validation is needed, FALSE otherwise. */ protected function needsValidation() { - return isset($this->configuration['validate']) ? $this->configuration['validate'] : FALSE; + return isset($this->configuration['validate']) ? TRUE : FALSE; } /**