From c0d26b97dd2b75880002673ced6e6007d0986148 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 10 Jul 2010 09:13:02 +0200 Subject: [PATCH] DDC-596 - Added validation of inheritance hierachies --- lib/Doctrine/ORM/Tools/SchemaValidator.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index 5fbe6fc72..8f1e97f21 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -178,7 +178,15 @@ class SchemaValidator if ($publicAttr->isStatic()) { continue; } - $ce[] = "Field '".$publicAttr->getName()."' in class '".$class->name."' must be private or protected. Public fields break lazy-loading."; + $ce[] = "Field '".$publicAttr->getName()."' in class '".$class->name."' must be private ". + "or protected. Public fields may break lazy-loading."; + } + + foreach ($class->subClasses AS $subClass) { + if (!in_array($class->name, class_parents($subClass))) { + $ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ". + "of '" . $class->name . "' but these entities are not related through inheritance."; + } } if ($ce) {