query = $query; } // findReductionCreditsByUser public function getByTypeAndUser(string $type = ReductionCreditModel::TYPE_CREDIT, UserInterface $user) { $query = $this->query->create(); $query ->filterStatusOnline() ->filterByType($type) ->filterByUser($user); return $query->find(); } public function isReductionGiftUsed(ReductionCreditInterface $reductionGift) { if ($this->orderShopStore->countValidOrderWithReductionCredit($reductionGift)) { return true; } else { return false; } } public function isReductionCreditUsed(ReductionCreditInterface $reductionCredit, UserInterface $user = null) { if ($this->orderShopStore->countValidOrderWithReductionCredit($reductionCredit, $user)) { return true; } else { return false; } } public function isReductionCreditAddedToOrder( OrderShopInterface $orderShop, ReductionCreditInterface $reductionCredit ) { foreach ($orderShop->getOrderReductionCredits() as $orderReductionCredit) { if ($orderReductionCredit->getReductionCredit() == $reductionCredit) { return true; } } return false; } }