isJoinUserMerchants) { $this->isJoinUserMerchants = true; return $this ->leftJoin('.userMerchants', 'userMerchants'); } return $this; } public function joinAddresses(): self { if (!$this->isJoinAddresses) { $this->isJoinAddresses = true; return $this ->innerJoin('.addresses', 'addresses'); } return $this; } public function filterMerchantIsActive(): self { $this->joinUserMerchants(); return $this ->andWhere('userMerchants.active = 1'); } public function filterByMerchant(Merchant $merchant): self { $this->joinUserMerchants(); return $this ->andWhere('userMerchants.merchant = :merchant') ->setParameter('merchant', $merchant); } public function filterByExtraInfoZip(string $zip) { $this->joinAddresses(); return $this ->andWhere('.extraInfoZip LIKE :extraInfoZip OR addresses.zip LIKE :extraInfoZip') ->setParameter('extraInfoZip', $zip); } public function filterByExtraInfoCity(string $city) { $this->joinAddresses(); return $this ->andWhere('.extraInfoCity LIKE :extraInfoCity OR addresses.city LIKE :extraInfoCity') ->setParameter('extraInfoCity', $city); } }