-
Notifications
You must be signed in to change notification settings - Fork 236
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
Inappropriate error detail for UniqueEntity annotation error #336
Comments
I'm transferring the issue, IMO it does not have to do with the ORM, you could have the same issue with any other kind of annotations. |
I disagree a little with the expected behavior, I would expect to have the
Possible next step: determine what pieces of information (classname? filename? line number?) we have at each level of this stack trace:
|
Sound good to me. As long as the message identifies an annotation failure in a particular file at a location in that file, I will be happy. Thanks for directing as well. |
The annotation reader has a method/property reflection object available; therefore, it should be easy to add filename, class name and method/property name into any exception message. However, because showing a filename in production may be undesirable, I would add class and method name only (it should suffice and not reveal any sensitive information). The line number may be complicated, because the reflection object provides start line of the method, not the docblock, so it would likely be wrong. |
Why would people display exception messages in production? Anyway, thanks for your insight, I think this is ready to be developed. @crayner , do you want to give it a go? Here is the piece of code that should have a annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php Lines 140 to 148 in 8fc7b23
|
Thanks @greg0ire , Sorry, I find contributing very difficult as I become upset about reviews that argue about stuff that I have already stated, but people do not read or understand. So, No, I will not move this forward. Thanks for the offer. |
If this error ever gets to a production site, the the developer never tested the code @jkufner as this is a HARD error. (i.e. HARD = it will fail 100% of the time, and is caused by the developer IMHO) |
@crayner Yes, however, it may happen after an update to a slightly incompatible version, or after not upgrading the dependencies. We cannot predict any particular context or scenario, so it is better to be careful by default. |
Bug Report
Summary
I found an error trying to validate the doctrine schema:
The issue here is not with the error, but in the fact that the error is not correctly identifying the issue, which is a annotation parse error, causing the Contraint violation. Unfortunately, this error does not identify the entity at fault, and I had to remove ALL UniqueEntity references in 150+ entities and return them one at a time to eventually find the error. The error on the annotation looks like:
The error is on the "name" line, which is missing the opening bracket.
Current behavior
The current behaviour is as stated above.
How to reproduce
Remove the opening bracket on any UniqueEntity annotation will duplicate this issue.
Expected behavior
The text was updated successfully, but these errors were encountered: