Symfony2 Doctrine oneToMany orderBy multiple columns

时间:2015-06-24 12:25:43

标签: php symfony doctrine-orm yaml

我有这样的代码(.yml):

oneToMany:
        products:
            targetEntity: SMS\Bundle\SwiadczeniaPlatne\Domain\Zlecenie\Produkt
            mappedBy: zlecenie
            cascade: [persist, remove]
            indexBy: id
            orphanRemoval: true
            orderBy: { patient: ASC, contract: ASC }

患者和合同是对象。我想通过patient.name和contract.name对产品进行排序。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

格式错误:

oneToMany:
        products:
            targetEntity: SMS\Bundle\SwiadczeniaPlatne\Domain\Zlecenie\Produkt
            mappedBy: zlecenie
            cascade: [persist, remove]
            indexBy: id
            orphanRemoval: true
            orderBy: 
                patient: ASC
                contract: ASC

为此doctrine2实体添加书签yaml参考要点:https://gist.github.com/mnapoli/3839501