1
0
mirror of synced 2024-12-13 22:56:04 +03:00

DDC-709 Add further validation for @OrderBy field names on target entities

This commit is contained in:
Benjamin Eberlei 2010-08-08 11:39:44 +02:00
parent bd28cb1b12
commit 9347263a43

View File

@ -1,7 +1,5 @@
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* 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) {