Throw an error when the identifier field is not available #62

Merged
merged 1 commit into from Jun 21, 2013

Conversation

Projects
None yet
2 participants
Contributor

wilonth commented Mar 7, 2013

I accidentally mapped an empty class, then I got 2 errors: "Undefined index: in ...Doctrine/ODM/CouchDB/Mapping/ClassMetadata.php", "Fatal error: Call to a member function getValue() on a non-object in .../Doctrine/ODM/CouchDB/Mapping/ClassMetadata.php".
the erroring part is reflFields[$this->identifier].
The reason is, there's no id field, it's a bit confusing and it wastes new user's time.
So there should be an error message.

Class Metadata: Throw a nice error message when the identifier field …
…is not available, instead of letting the user confused with PHP's Undefined index and another fatal PHP error.

beberlei added a commit that referenced this pull request Jun 21, 2013

Merge pull request #62 from phaikawl/master
Throw an error when the identifier field is not available

@beberlei beberlei merged commit 77f5b5b into doctrine:master Jun 21, 2013

beberlei added a commit that referenced this pull request Jun 22, 2013

Merge pull request #67 from marnusw/id_field_check
Fix Pull #62 error: ClassMetadataInfo::checkUp() - Embedded documents shouldn't have an id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment