andWhere('.user = :user') ->setParameter('user', $user); } public function joinUser(): self { if (!$this->isJoinUser) { $this->isJoinUser = true; return $this ->leftJoin('.user', 'user'); } return $this; } public function filterByStatus($statusArray): self { return $this ->andWhere('.status IN (:status)') ->setParameter('status', $statusArray); } public function filterByFirstname(string $firstname) { $this->joinUser(); return $this ->andWhere('.visitorFirstname LIKE :firstname OR user.firstname LIKE :firstname') ->setParameter('firstname', $firstname); } public function filterByLastname(string $lastname) { $this->joinUser(); return $this ->andWhere('.visitorLastname LIKE :lastname OR user.lastname LIKE :lastname') ->setParameter('lastname', $lastname); } public function filterByEmail(string $email) { $this->joinUser(); return $this ->andWhere('.visitorEmail LIKE :email OR user.email LIKE :email') ->setParameter('email', $email); } public function selectCount(): self { return $this ->select('count(ticket.id) as count'); } public function filterByVisitorToken(string $visitorToken): self { return $this ->andWhere('.visitorToken LIKE :visitorToken') ->setParameter('visitorToken', $visitorToken); } }