Hello everyone,

I'm new to learning Doctrine, and so far it's been really great! I love how 
easy it is to work with entities and have Doctrine map table data to php 
classes. I'm looking forward to learning more and seeing how Doctrine can 
improve my productivity. That said, there has been one really noticeable 
pain point: DQL error messages. When everything works correctly DQL is nice 
and convenient. But when DQL fails (or rather when I fail at writing DQL) 
the error messages are terrible. 

For really obvious mistakes, like when I'm accidentally missing a keyword 
like WHERE or FROM, the error message is basically useless. Sure I see 
->syntaxError('end of string') in the exception trace, but there's no 
information regarding the location of the error. Where exactly is the 
unexpected end of the string?

For non-obvious mistakes, where the DQL syntax is correct, but there's a 
problem with what I'm asking Doctrine to do, the error messages improve, 
but they are still poor. I might see something like semanticalError('line 
0, col 61...') that at least gives me an idea as to the location of the 
problem. But it would be much better if the error included the problematic 
detail directly. Consider the dead simple example "SELECT s.wrong FROM 
Submission s", where the "wrong" property doesn't exist for the Submission 
entity. Why can't DQL quote that "s.wrong" is the unknown path expression 
(or that "wrong" is the unknown property?) instead of making me interpret 
Doctrine parser backtraces and look up character offsets?

Those are all simple examples. Right now I'm trying to get a LEFT JOIN 
working and I have no idea what I'm doing wrong. I'm certain that it's my 
fault (working with databases isn't my regular job) but the DQL error 
messages sure aren't helping. It's quoting me a line/col number that puts 
the error inside the JOIN keyword; the "col" index is literally between the 
"I" and "N" characters! I expect this is due to the fact that my DQL string 
is multi-line. I assume my string is collapsed to a single line before 
execution, since the error location is always "line 0". Most likely 
Doctrine did not adjust its character index to account for the removed 
newlines. I can take that into account manually when I count characters, 
but this is just another example of poor error reporting wasting my time. I 
can give many more examples, and I've only recently started using DQL.

As I mentioned earlier, working with databases isn't what I do most of the 
time. But when I've worked with regular SQL the error messages were pretty 
good at helping me figure out what I did wrong. An SQL error like "unknown 
column 'wrong'" points you right to your mistake. I'd love to see Doctrine 
do the same. I think this would go a long way towards making Doctrine more 
usable and friendly.

I don't know if this is the best venue for this feedback. If there's a 
better way to communicate this issue to the Doctrine team please let me 
know. I just want to see the project improved, because so far I see that 
it's a very nice tool with a lot of benefits.

Thanks for listening!
~Martin

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/doctrine-user/4fa5e98a-1247-47b4-8acb-d5012a97ae91o%40googlegroups.com.

Reply via email to