DDC-1524 - Add validation and error messages for annotation named query code.
This commit is contained in:
parent
98bd5cae64
commit
6015253064
@ -192,7 +192,14 @@ class AnnotationDriver implements Driver
|
||||
if (isset($classAnnotations['Doctrine\ORM\Mapping\NamedQueries'])) {
|
||||
$namedQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedQueries'];
|
||||
|
||||
if (!is_array($namedQueriesAnnot->value)) {
|
||||
throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
|
||||
}
|
||||
|
||||
foreach ($namedQueriesAnnot->value as $namedQuery) {
|
||||
if (!($namedQuery instanceof \Doctrine\ORM\Mapping\NamedQuery)) {
|
||||
throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
|
||||
}
|
||||
$metadata->addNamedQuery(array(
|
||||
'name' => $namedQuery->name,
|
||||
'query' => $namedQuery->query
|
||||
|
Loading…
x
Reference in New Issue
Block a user