/** * @param string[] $voucherCodes * * @return \Orm\Zed\Discount\Persistence\SpyDiscount[] */ protected function retrieveActiveCartAndVoucherDiscounts(array $voucherCodes = []) { $discounts = $this->queryContainer->queryActiveCartRules()->find(); if (count($voucherCodes) > 0) { $voucherDiscounts = $this->queryContainer->queryDiscountsBySpecifiedVouchers($voucherCodes)->find(); $voucherDiscounts = $this->filterUniqueVoucherDiscounts($voucherDiscounts); if (count($discounts) == 0) { return $voucherDiscounts; } foreach ($voucherDiscounts as $discountEntity) { $discounts->append($discountEntity); } } return $discounts; }