public function findAllByGroupQuery(GroupInterface $group, bool $active = true): Query
    {
        $qb = $this->createQueryBuilder('r');

        return $qb
            ->join('r.groups', 'g')

            // Add conditions.
            ->andWhere($qb->expr()->eq('g', ':group'))
            ->andWhere($qb->expr()->eq('r.active', ':active'))

            // Add parameters.
            ->setParameter('group', $group)
            ->setParameter('active', $active)

            // Order by and get results.
            ->orderBy('r.pinned', 'DESC')
            ->addOrderBy('r.name', 'ASC')
            ->getQuery();
    }
public function findAllByGroupQuery(GroupInterface $group, bool $active = true): Query
    {
        $qb = $this->createQueryBuilder('r');

        return $qb
            ->join('r.groups', 'g')

            // Add conditions.
            ->andWhere($qb->expr()->eq('g', ':group'))
            ->andWhere($qb->expr()->eq('r.active', ':active'))

            // Add parameters.
            ->setParameter('group', $group)
            ->setParameter('active', $active)

            // Order by and get results.
            ->orderBy('r.pinned', 'DESC')
            ->addOrderBy('r.name', 'ASC')
            ->getQuery();
    }
public function findAllByGroupQuery ( GroupInterface $ group , bool $ active = true ) : Query { $ qb = $ this -> createQueryBuilder ( 'r' ) ; return $ qb -> join ( 'r.groups' , 'g' ) // Add conditions. -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':group' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.active' , ':active' ) ) // Add parameters. -> setParameter ( 'group' , $ group ) -> setParameter ( 'active' , $ active ) // Order by and get results. -> orderBy ( 'r.pinned' , 'DESC' ) -> addOrderBy ( 'r.name' , 'ASC' ) -> getQuery ( ) ; }
Get the query to find all resources by group.

@param GroupInterface $group  The group to search in.
@param bool           $active The active state to search.

@return Query
Get the query to find all resources by group .