public function getAllInactiveQuery(Production $production): Query
    {
        $qb = $this->createQueryBuilder('p');

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

            // Add conditions.
            ->andWhere($qb->expr()->eq('g', ':group'))
            ->andWhere($qb->expr()->isNull('p.parent'))
            ->andWhere($qb->expr()->orX(
                $qb->expr()->eq('p.active', ':active'),
                $qb->expr()->lt('p.expiry', ':now')
            ))

            // Add parameters.
            ->setParameter('group', $production)
            ->setParameter('active', false)
            ->setParameter('now', new \DateTime())

            // Order by and get results.
            ->addOrderBy('p.updated', 'DESC')
            ->getQuery();
    }
public function getAllInactiveQuery(Production $production): Query
    {
        $qb = $this->createQueryBuilder('p');

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

            // Add conditions.
            ->andWhere($qb->expr()->eq('g', ':group'))
            ->andWhere($qb->expr()->isNull('p.parent'))
            ->andWhere($qb->expr()->orX(
                $qb->expr()->eq('p.active', ':active'),
                $qb->expr()->lt('p.expiry', ':now')
            ))

            // Add parameters.
            ->setParameter('group', $production)
            ->setParameter('active', false)
            ->setParameter('now', new \DateTime())

            // Order by and get results.
            ->addOrderBy('p.updated', 'DESC')
            ->getQuery();
    }
public function getAllInactiveQuery ( Production $ production ) : Query { $ qb = $ this -> createQueryBuilder ( 'p' ) ; return $ qb -> join ( 'p.groups' , 'g' ) // Add conditions. -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':group' ) ) -> andWhere ( $ qb -> expr ( ) -> isNull ( 'p.parent' ) ) -> andWhere ( $ qb -> expr ( ) -> orX ( $ qb -> expr ( ) -> eq ( 'p.active' , ':active' ) , $ qb -> expr ( ) -> lt ( 'p.expiry' , ':now' ) ) ) // Add parameters. -> setParameter ( 'group' , $ production ) -> setParameter ( 'active' , false ) -> setParameter ( 'now' , new \ DateTime ( ) ) // Order by and get results. -> addOrderBy ( 'p.updated' , 'DESC' ) -> getQuery ( ) ; }
Query to find all inactive posts.

@param Production $production The production to search for.

@return Query
Query to find all inactive posts .