Doctrine DQL and Namespaces (relative only?)

蓝咒 提交于 2019-12-10 13:57:52

问题


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?


回答1:


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 \



来源:https://stackoverflow.com/questions/3327835/doctrine-dql-and-namespaces-relative-only

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!