diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index cf0c6d9cd..2056af6f8 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -170,6 +170,10 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory continue; } + if (!isset($embeddableClass['class'])) { + throw MappingException::missingEmbeddedClass($property); + } + if (isset($this->embeddablesActiveNesting[$embeddableClass['class']])) { throw MappingException::infiniteEmbeddableNesting($class->name, $property); } diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index 7a8eaada6..9e6b4b33f 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -105,6 +105,16 @@ class MappingException extends \Doctrine\ORM\ORMException return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); } + /** + * @param string $fieldName + * + * @return MappingException + */ + public static function missingEmbeddedClass($fieldName) + { + return new self("The embed mapping '$fieldName' misses the 'class' attribute."); + } + /** * @param string $entityName * @param string $fileName