1
0
mirror of synced 2024-12-14 23:26:04 +03:00

DDC-1530 - Validate field types in SchemaValidator

This commit is contained in:
Benjamin Eberlei 2011-12-19 10:10:56 +01:00
parent 4f67ea3869
commit 40800bd3cd

View File

@ -21,6 +21,7 @@ namespace Doctrine\ORM\Tools;
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 @@ class SchemaValidator
$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.';