Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Embeddables] Improved exception message #1133

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Expand Up @@ -153,6 +153,10 @@ protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonS
continue;
}

if (!isset($embeddableClass['class'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put spaces around !.

throw MappingException::missingEmbeddedClass($property);
}

if (isset($this->embeddablesActiveNesting[$embeddableClass['class']])) {
throw MappingException::infiniteEmbeddableNesting($class->name, $property);
}
Expand Down
10 changes: 10 additions & 0 deletions lib/Doctrine/ORM/Mapping/MappingException.php
Expand Up @@ -105,6 +105,16 @@ public static function missingSourceEntity($fieldName)
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
Expand Down