1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Merge remote-tracking branch 'schmittjoh/betterExMessage'

This commit is contained in:
Alexander 2012-05-04 18:20:56 +02:00
commit 3403305b3d
2 changed files with 11 additions and 7 deletions

View File

@ -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
*

View File

@ -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
));
}
}