索纳塔左联接未在列表显示中分组

时间:2020-03-08 16:02:03

标签: sonata-admin

在奏鸣曲列表中,我想将以下联接分成多行而不是对id进行分组,最佳的设计是什么?

screenshot of the current display

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')
            ->add('subscriptionBillings')
            ->add('packPurchases')
            ->add('s.id') // Does not match the join, display the main entity id instead
        ;
    }
    public function createQuery($context = 'list')
    {
        $query = parent::createQuery();
        $query->leftJoin($query->getRootAlias() . '.subscriptionBillings', 's');
        $query->leftJoin($query->getRootAlias() . '.packPurchases', 'p');
        return $query;
    }

谢谢

0 个答案:

没有答案
相关问题