Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
1.0 kB
2
Indexable
Never
    public function getActivitiesBuilder($ids)
    {
        $builder = $this->eventManager->getEntityManager()
            ->getRepository('GetCity\PortalBundle\Entity\Activity')
            ->createQueryBuilder('a')
            ->select('distinct a.id as activity_id, a.duration, atr.title, atr.description, atr.lead, pt.name as place_name, p.id as place_id, attr.title as category_name, s.name as supplier_name, s.id as supplier_id ')
            ->join('a.activityType', 'at')
            ->join('at.translations', 'attr')
            ->join('a.translations', 'atr')
            ->join('a.supplier', 's')
            ->leftJoin('a.place', 'p')
            ->leftJoin('p.translations', 'pt')
            ->andWhere("a.id in (:ids)")
            ->andWhere('atr.locale = :locale')
            ->andWhere('pt.locale = :locale')
            ->andWhere('attr.locale = :locale')
            ->setParameter('locale', 'ru')
            ->setParameter('ids', $ids)
        ;

        return $builder;
    }