From 9347263a43d370ba72300834aa1c5027fb4882ea Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 8 Aug 2010 11:39:44 +0200 Subject: [PATCH] DDC-709 Add further validation for @OrderBy field names on target entities --- lib/Doctrine/ORM/Tools/SchemaValidator.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index 8f1e97f21..d109832a9 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -1,7 +1,5 @@ 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) {