Escaping backslash in namespaces with DQL (Doctrine 2)?

See Dynamic namespace names (quoted identifiers) should escape backslash Looks like the first syntax is just lucky. :) I haven't tried it myself, so if you say that query with escaping works just as query without escping, it's better use escaped queries.

Btw, I've checked some working code in my project... Single backslash works even inside double-quoted strings. The only way to crash it is using single \ inside double-quoted string before some character, that forms an escape sequence together with \. – J0HN Aug 14 at 9:29 Yes, Doctrine's docs are really really wrong, I mean, their examples works fine, but only because they are using Uppercases for their names (hence you can't form an escape sequence) but the best practice is to escape the backslash, thanks for the link JOHN!

– Enrique Aug 15 at 23:16.

Good point, but DQL takes query and matches to Namespace and Class before sending parsed query to database engine. MyProject\Model\User is trim down to table name specified in User class. SELECT you FROM MyProject\Model\User you WHERE u.

Age > 20 becomes SELECT you FROM userie table name specified in User class you WHERE u. Age > 20.

Yes I know that our DQL is not the final query, but "createQuery" receives a string, and a string is a string anywhere, and a backslash in a string is a special character. At really, I don't understand how can those DQL (strings) work without escaping the backslashes. What happen if we have a namespace like \new\Table?

Inside the string "\n" is not interpreted as a new line? If you escape the backslash in DQL you don't get any warning, and of course, the query works as expected. I think that is the "correct" way, but a I can't understand why no body is escaping the backslash in DQL.

– Enrique Aug 13 at 3:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions