2010-07-25 18 views
5

我注意到,如果我嘗試做soemthing像主義DQL和命名空間(相對而已?)

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

我得到

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

,如果我做

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

其確定。所以問題是,我可以說DQL只接受DQL語句中的相對名稱空間嗎?

+0

這看起來像一個bug。 AFAIK Doctrine 2尚未發佈,因此您可能需要向開發人員報告。 – 2010-07-25 03:16:40

回答

8

我找到了答案,在doctrine forums

There are no "relative" namespaces in strings

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