Doctrine DQL and Namespaces (relative only?)
Asked Answered
P

1

5

i noticed that if i try to do soemthing like

$query = $em->createQuery('SELECT u FROM \Application\Entities\User u');

i get

[Semantical Error] line 0, col 14 near '\Application\Entities\User': Error: Class '\' is not defined.

if i do

$query = $em->createQuery('SELECT u FROM Application\Entities\User u');

its ok. so the question is, can i say that DQL only accepts relative namespaces in DQL statements?

Pitchdark answered 25/7, 2010 at 3:8 Comment(1)
That looks like a bug. AFAIK Doctrine 2 isn't released yet, so you might want to report that to the developers.Giuseppinagiustina
P
8

i found the answer at doctrine forums

There are no "relative" namespaces in strings

It must be the fully qualified class name minus the beginning \

Pitchdark answered 26/7, 2010 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.