/** * @param string $code * * @return bool */ public function isUsable($code) { $discountVoucherEntity = $this->discountQueryContainer->queryVoucher($code)->findOne(); if (!$discountVoucherEntity) { $this->addMessage(self::REASON_VOUCHER_CODE_NOT_FOUND); return false; } return $this->validateDiscountVoucher($discountVoucherEntity); }
/** * @param string $code * * @return \Orm\Zed\Discount\Persistence\SpyDiscountVoucher */ protected function getDiscountVoucherEntityByCode($code) { return $this->discountQueryContainer->queryVoucher($code)->findOne(); }