DDC-1530 - Validate field types in SchemaValidator
This commit is contained in:
parent
4f67ea3869
commit
40800bd3cd
@ -21,6 +21,7 @@ namespace Doctrine\ORM\Tools;
|
|||||||
|
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||||
|
use Doctrine\DBAL\Types\Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs strict validation of the mapping schema
|
* Performs strict validation of the mapping schema
|
||||||
@ -87,6 +88,12 @@ class SchemaValidator
|
|||||||
$ce = array();
|
$ce = array();
|
||||||
$cmf = $this->em->getMetadataFactory();
|
$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) {
|
foreach ($class->associationMappings AS $fieldName => $assoc) {
|
||||||
if (!$cmf->hasMetadataFor($assoc['targetEntity'])) {
|
if (!$cmf->hasMetadataFor($assoc['targetEntity'])) {
|
||||||
$ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown.';
|
$ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown.';
|
||||||
|
Loading…
Reference in New Issue
Block a user