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) {