andWhere(':user MEMBER OF .users') ->setParameter('user', $user); } public function filterByOwner(UserInterface $user) { return $this ->andWhere('.owner = :user') ->setParameter('user', $user); } public function filterByType(string $type = ReductionCreditModel::TYPE_CREDIT) { return $this ->andWhere('.type = :type') ->setParameter('type', $type); } public function filterInactive() { $this->joinUsers(); return $this->having('COUNT(users.id) = 0'); } public function filterActive() { $this->joinUsers(); return $this->having('COUNT(users.id) > 0'); } public function joinUsers() { return $this->leftJoin('.users', 'users'); } }