public function findPendingInvitationsQuery(UserInterface $user)
    {
        $qb = $this->createQueryBuilder('i');

        return $qb
            ->join('i.event', 'e')

            // Add conditions.
            ->andWhere($qb->expr()->eq('e.active', ':active'))
            ->andWhere($qb->expr()->gt('e.end', ':now'))
            ->andWhere($qb->expr()->isNull('i.response'))
            ->andWhere($qb->expr()->eq('i.invitee', ':invitee'))

            // Add parameters.
            ->setParameter('active', true)
            ->setParameter('now', new \DateTime())
            ->setParameter('invitee', $user->getUsername())

            // Get query.
            ->getQuery();
    }
public function findPendingInvitationsQuery(UserInterface $user)
    {
        $qb = $this->createQueryBuilder('i');

        return $qb
            ->join('i.event', 'e')

            // Add conditions.
            ->andWhere($qb->expr()->eq('e.active', ':active'))
            ->andWhere($qb->expr()->gt('e.end', ':now'))
            ->andWhere($qb->expr()->isNull('i.response'))
            ->andWhere($qb->expr()->eq('i.invitee', ':invitee'))

            // Add parameters.
            ->setParameter('active', true)
            ->setParameter('now', new \DateTime())
            ->setParameter('invitee', $user->getUsername())

            // Get query.
            ->getQuery();
    }
public function findPendingInvitationsQuery ( UserInterface $ user ) { $ qb = $ this -> createQueryBuilder ( 'i' ) ; return $ qb -> join ( 'i.event' , 'e' ) // Add conditions. -> andWhere ( $ qb -> expr ( ) -> eq ( 'e.active' , ':active' ) ) -> andWhere ( $ qb -> expr ( ) -> gt ( 'e.end' , ':now' ) ) -> andWhere ( $ qb -> expr ( ) -> isNull ( 'i.response' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'i.invitee' , ':invitee' ) ) // Add parameters. -> setParameter ( 'active' , true ) -> setParameter ( 'now' , new \ DateTime ( ) ) -> setParameter ( 'invitee' , $ user -> getUsername ( ) ) // Get query. -> getQuery ( ) ; }
Build query to find pending invitations for a user.

@param UserInterface $user The user to find invitations for.

@return Invitation[]
Build query to find pending invitations for a user .