diff --git a/Core/MigrationService.php b/Core/MigrationService.php index e325653c..8b824a34 100644 --- a/Core/MigrationService.php +++ b/Core/MigrationService.php @@ -302,24 +302,32 @@ protected function getFullExceptionMessage(\Exception $e) $message = $e->getMessage(); if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\ContentTypeFieldDefinitionValidationException') || is_a($e, '\eZ\Publish\API\Repository\Exceptions\ContentTypeFieldValidationException') || - is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException') + is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException') || + is_a($e, '\eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException') ) { if (is_a($e, '\eZ\Publish\API\Repository\Exceptions\LimitationValidationException')) { $errorsArray = $e->getLimitationErrors(); if ($errorsArray == null) { return $message; } - $errorsArray = array($errorsArray); + } else if (is_a($e, '\eZ\Publish\Core\Base\Exceptions\ContentFieldValidationException')) { + foreach ($e->getFieldErrors() as $limitationError) { + // we get the 1st language + $errorsArray[] = reset($limitationError); + } } else { $errorsArray = $e->getFieldErrors(); } foreach ($errorsArray as $errors) { - + // sometimes error arrays are 2-level deep, sometimes 1... + if (!is_array($errors)) { + $errors = array($errors); + } foreach ($errors as $error) { /// @todo find out what is the proper eZ way of getting a translated message for these errors $translatableMessage = $error->getTranslatableMessage(); - if (is_a($e, 'eZ\Publish\API\Repository\Values\Translation\Plural')) { + if (is_a($translatableMessage, '\eZ\Publish\API\Repository\Values\Translation\Plural')) { $msgText = $translatableMessage->plural; } else { $msgText = $translatableMessage->message; @@ -329,6 +337,11 @@ protected function getFullExceptionMessage(\Exception $e) } } } + + while (($e = $e->getPrevious()) != null) { + $message .= "\n" . $e->getMessage(); + } + return $message; } } diff --git a/Core/ReferenceResolver/LocationResolver.php b/Core/ReferenceResolver/LocationResolver.php index 24f7fe11..6ddb1a4b 100644 --- a/Core/ReferenceResolver/LocationResolver.php +++ b/Core/ReferenceResolver/LocationResolver.php @@ -12,7 +12,7 @@ class LocationResolver extends AbstractResolver /** * Defines the prefix for all reference identifier strings in definitions */ - protected $referencePrefixes = array('location_remote_id:', 'location:'); + protected $referencePrefixes = array('location:'/*, 'location_remote_id:'*/); protected $repository; @@ -37,7 +37,7 @@ public function getReferenceValue($stringIdentifier) switch($ref['prefix']) { /// @deprecated !!! case 'location:': - case 'location_remote_id:': + //case 'location_remote_id:': return $this->repository->getLocationService()->loadLocationByRemoteId($ref['identifier'])->id; //case 'location_id::': // return $this->repository->getLocationService()->loadLocation($ref['identifier']); diff --git a/WHATSNEW.md b/WHATSNEW.md index 66bd405b..ed7464b6 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,3 +1,11 @@ +Version 2.5.1 +============= + +* Fix: bring back the support for resolving 'location:' tags as was done in version 1.X of the extension + +* New: improve error messages pertaining to content creation/update + + Version 2.5 ===========