gpt4 book ai didi

Doctrine DQL 和命名空间(仅相对?)

转载 作者:行者123 更新时间:2023-12-02 22:08:53 26 4
gpt4 key购买 nike

我注意到如果我尝试做类似的事情

$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 语句中的相对命名空间吗?

最佳答案

我在 doctrine forums 找到了答案

There are no "relative" namespaces in strings

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

关于Doctrine DQL 和命名空间(仅相对?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3327835/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com