public function addProductionFilter(FilterCollectionEvent $event): void
    {
        $now = new \DateTime();
        $qb = $event->getQueryBuilder();
        $query = $qb->query()->bool()
            ->addMust($qb->query()->term(['_index' => 'production']))
            ->addMust($qb->query()->term(['active' => true]))
            ->addMust($qb->query()->terms('id', $event->getGroupIds()))
            ->addMust(
                $qb->query()->bool()
                    ->addShould($qb->query()->range('expiry', ['gt' => $now->format('U') * 1000]))
                    ->addShould($qb->query()->bool()->addMustNot($qb->query()->exists('expiry')))
            )
        ;
        $event->addFilter($query);
    }
public function addProductionFilter(FilterCollectionEvent $event): void
    {
        $now = new \DateTime();
        $qb = $event->getQueryBuilder();
        $query = $qb->query()->bool()
            ->addMust($qb->query()->term(['_index' => 'production']))
            ->addMust($qb->query()->term(['active' => true]))
            ->addMust($qb->query()->terms('id', $event->getGroupIds()))
            ->addMust(
                $qb->query()->bool()
                    ->addShould($qb->query()->range('expiry', ['gt' => $now->format('U') * 1000]))
                    ->addShould($qb->query()->bool()->addMustNot($qb->query()->exists('expiry')))
            )
        ;
        $event->addFilter($query);
    }
public function addProductionFilter ( FilterCollectionEvent $ event ) : void { $ now = new \ DateTime ( ) ; $ qb = $ event -> getQueryBuilder ( ) ; $ query = $ qb -> query ( ) -> bool ( ) -> addMust ( $ qb -> query ( ) -> term ( [ '_index' => 'production' ] ) ) -> addMust ( $ qb -> query ( ) -> term ( [ 'active' => true ] ) ) -> addMust ( $ qb -> query ( ) -> terms ( 'id' , $ event -> getGroupIds ( ) ) ) -> addMust ( $ qb -> query ( ) -> bool ( ) -> addShould ( $ qb -> query ( ) -> range ( 'expiry' , [ 'gt' => $ now -> format ( 'U' ) * 1000 ] ) ) -> addShould ( $ qb -> query ( ) -> bool ( ) -> addMustNot ( $ qb -> query ( ) -> exists ( 'expiry' ) ) ) ) ; $ event -> addFilter ( $ query ) ; }
Add the production filter to the main query.

@param FilterCollectionEvent $event The filter collection event.

@return void
Add the production filter to the main query .