English 中文(简体)
按加入表格领域分列的原则2
原标题:Doctrine 2 ORDER BY the field of a joinTable

我有一个实体的定义是这样的:

Munkatars:
    id:
        id:
            type: integer
    fields:
        nev:
            type: text
        [...]
    manyToOne:
        vezeto:
            targetEntity: Munkatars
            inversedBy: alarendeltek
    oneToMany:
        alarendeltek:
            targetEntity: Munkatars
            mappedBy: vezeto
            fetch: EXTRA_LAZY

是否有方法来创建查询, 通过这些 < code> Munkatars 对象的 < code> / code> 命令其 < code> vezeto s < code> nev 字段?

我尝试过用m.vezeto.nev来命令,但这给了我一个错误, 而文件没有提供多少关于这个的信息。

最佳回答

您必须使用类似此示例的连结 :

createQuery("SELECT m.nev 
             FROM  EntityMunkatars as m 
             LEFT JOIN m.vezeto as v
             ORDER BY v.nev");
问题回答

暂无回答




相关问题
Zend and static class properties

I m trying to assign a value to a static class property when defining it: namespace Base; abstract class Skeleton { protected static $entityManager = end_Registry::get("EntityManager"); ......

require_once missing doctrine zend framework

I m integrating doctrine with Zend Framework. I ve hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for ...

doctrine: QueryBuilder vs createQuery?

In Doctrine you can create DQL in 2 ways: EntityManager::createQuery: $query = $em->createQuery( SELECT u FROM MyProjectModelUser u WHERE u.id = ?1 ); QueryBuilder: $qb->add( select , u ) ...

热门标签