query = $query; $this->userMerchantSolver = $userMerchantSolver; } public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface { $query->orderBy('id'); return $query; } public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface { $query->filterByMerchant($this->merchant); return $query; } public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface { return $query; } // getUserMerchant public function getOneByUser(UserInterface $user, $query = null): ?UserMerchantInterface { $query = $this->createDefaultQuery($query); $query->filterByUser($user); return $query->findOne(); } public function isCreditActiveByUser(UserInterface $user, $query = null): bool { $userMerchant = $this->getOneByUser($user, $query); return $this->userMerchantSolver->isCreditActive($userMerchant); } }