Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Improved error message #286

Merged
merged 1 commit into from Jul 26, 2014
Merged

Conversation

dantleech
Copy link
Contributor

No description provided.

lsmith77 added a commit that referenced this pull request Jul 26, 2014
@lsmith77 lsmith77 merged commit 1f9ecfd into sonata-project:master Jul 26, 2014
in the Reference.', $fieldDescription->getName()));
throw new \LogicException(sprintf(
'The field "%s" in class "%s" does not have a target model defined. ' .
'Please specify the "target document" attribute in the mapping for this class.',
Copy link
Contributor

Choose a reason for hiding this comment

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

targetDocument is the annotation/yml/xml attribute name, so it sould not have gotten a space here imho.

otherwise agree with the fix, exceptions need to tell as much context as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would you suggest instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed in a7d7820

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, the XML name is target-document which is why I used the space ... I put targetDocument in my mapping file and was debugging that for half an hour before realising the errpr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be possible to validate the XML schema?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is targetDocument in annotations. i guess we could try to formulate it a bit more agnostic ..

'Please specify a target document in the mapping for this class property.'

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, sorry. so we should say it with a space then, and people who are confused can go look it up in the doc what it is in xml / annotations and get the right thing.

the xml schema validation i don't know. ah, that is not bundle configuration but the doctrine mappings.

Copy link
Contributor

Choose a reason for hiding this comment

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

imho changing it from "the" to "a" makes it clearer that we are not naming the exact attribute one must set.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants