From 40800bd3cdbb0e932ae71bf050d158e965d8d808 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 19 Dec 2011 10:10:56 +0100 Subject: [PATCH] DDC-1530 - Validate field types in SchemaValidator --- lib/Doctrine/ORM/Tools/SchemaValidator.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/SchemaValidator.php b/lib/Doctrine/ORM/Tools/SchemaValidator.php index 93a5013be7e..f6bcadb722a 100644 --- a/lib/Doctrine/ORM/Tools/SchemaValidator.php +++ b/lib/Doctrine/ORM/Tools/SchemaValidator.php @@ -21,6 +21,7 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\DBAL\Types\Type; /** * Performs strict validation of the mapping schema @@ -87,6 +88,12 @@ public function validateClass(ClassMetadataInfo $class) $ce = array(); $cmf = $this->em->getMetadataFactory(); + foreach ($class->fieldMappings as $fieldName => $mapping) { + if (!Type::hasType($mapping['type'])) { + $ce[] = "The field '" . $class->name . "#" . $fieldName."' uses a non-existant type '" . $mapping['type'] . "'."; + } + } + foreach ($class->associationMappings AS $fieldName => $assoc) { if (!$cmf->hasMetadataFor($assoc['targetEntity'])) { $ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown.';