Doctrine Query Class Not in Entity Directory

▼魔方 西西 提交于 2019-12-12 10:12:28

问题


My Entity directory for my bundle is getting quite large. I'd like to be able to group my classes into sub-directories. For example, all forum related classes in Entity/Forum/. I've been able to do this relatively successfully, but I don't know how to do a doctrine query now.

The following doesn't work.

SELECT fp
FROM AcmeMainBundle:ForumPost fp
WHERE 1

How do I query an entity not directly in the Entity Folder?


回答1:


SELECT fp
FROM AcmeMainBundle:Forum\ForumPost fp
WHERE 1

This will work as long as you have changed the namespace of the entities you are moving to a seperate folder, for example Acme\MainBundle\Entity\Forum\ForumPost



来源:https://stackoverflow.com/questions/21052273/doctrine-query-class-not-in-entity-directory

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