DDC-709 Add further validation for @OrderBy field names on target entities
This commit is contained in:
parent
bd28cb1b12
commit
9347263a43
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -172,6 +170,16 @@ class SchemaValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($assoc->orderBy) && $assoc->orderBy !== null) {
|
||||||
|
$targetClass = $cmf->getMetadataFor($assoc->targetEntityName);
|
||||||
|
foreach ($assoc->orderBy AS $orderField => $orientation) {
|
||||||
|
if (!$targetClass->hasField($orderField)) {
|
||||||
|
$ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " .
|
||||||
|
$orderField . " that is not a field on the target entity " . $targetClass->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($class->reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $publicAttr) {
|
foreach ($class->reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $publicAttr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user