diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 81acb8021..d34bb31ae 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1322,7 +1322,9 @@ class ClassMetadataInfo implements ClassMetadata if (count($cascades) !== count(array_intersect($cascades, array('remove', 'persist', 'refresh', 'merge', 'detach')))) { throw MappingException::invalidCascadeOption( - array_diff($cascades, array_intersect($cascades, array('remove', 'persist', 'refresh', 'merge', 'detach'))) + array_diff($cascades, array_intersect($cascades, array('remove', 'persist', 'refresh', 'merge', 'detach'))), + $this->name, + $mapping['fieldName'] ); } @@ -1706,7 +1708,7 @@ class ClassMetadataInfo implements ClassMetadata { return $this->generatorType == self::GENERATOR_TYPE_NONE; } - + /** * Checks whether the class use a UUID for id generation * diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index dcf3a7da8..c86a07da9 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -422,12 +422,14 @@ class MappingException extends \Doctrine\ORM\ORMException return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'."); } - public static function invalidCascadeOption(array $cascades) + public static function invalidCascadeOption(array $cascades, $className, $propertyName) { $cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades)); - return new self( - "Invalid cascade option(s) specified: " . $cascades . ". " . - "Only 'remove', 'persist', 'refresh', 'merge' and 'detach' are allowed." - ); + return new self(sprintf( + 'You have specified invalid cascade options for %s::$%s: %s; available options: "remove", "persist", "refresh", "merge", and "detach"', + $className, + $propertyName, + $cascades + )); } }