improved exception message
This commit is contained in:
parent
cc06508bd4
commit
84ec6dc9f5
@ -1212,7 +1212,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']
|
||||
);
|
||||
}
|
||||
|
||||
@ -1596,7 +1598,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
{
|
||||
return $this->generatorType == self::GENERATOR_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the class use a UUID for id generation
|
||||
*
|
||||
|
@ -355,12 +355,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
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user