Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine DQL and Namespaces (relative only?)

Tags:

doctrine

dql

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?

like image 283
Jiew Meng Avatar asked Jul 25 '10 03:07

Jiew Meng


1 Answers

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 \

like image 176
Jiew Meng Avatar answered Sep 22 '22 12:09

Jiew Meng