/** * @param integer $idDiscount * @param \Orm\Zed\Discount\Persistence\SpyDiscount $discountEntity * @param \Generated\Shared\Transfer\DiscountConfiguratorTransfer $discountConfigurator * * @return void */ protected function hydrateDiscountVoucher($idDiscount, SpyDiscount $discountEntity, DiscountConfiguratorTransfer $discountConfigurator) { if ($discountEntity->getFkDiscountVoucherPool()) { $discountVoucherTransfer = new DiscountVoucherTransfer(); $discountVoucherTransfer->setIdDiscount($idDiscount); $discountVoucherTransfer->setFkDiscountVoucherPool($discountEntity->getFkDiscountVoucherPool()); $discountConfigurator->setDiscountVoucher($discountVoucherTransfer); } }
/** * @param \Generated\Shared\Transfer\DiscountVoucherTransfer $discountVoucherTransfer * @param \Orm\Zed\Discount\Persistence\SpyDiscount $discountEntity * * @return \Generated\Shared\Transfer\VoucherCreateInfoTransfer */ protected function persistVoucherCodes(DiscountVoucherTransfer $discountVoucherTransfer, SpyDiscount $discountEntity) { $discountVoucherPoolEntity = $this->saveVoucherPool($discountEntity); $discountEntity->setFkDiscountVoucherPool($discountVoucherPoolEntity->getIdDiscountVoucherPool()); $discountEntity->save(); $discountVoucherTransfer->setFkDiscountVoucherPool($discountVoucherPoolEntity->getIdDiscountVoucherPool()); return $this->voucherEngine->createVoucherCodes($discountVoucherTransfer); }