Example #1
0
 /**
  * @param \Orm\Zed\Discount\Persistence\SpyDiscount $discountEntity
  *
  * @return \Orm\Zed\Discount\Persistence\SpyDiscountVoucherPool
  */
 protected function saveVoucherPool(SpyDiscount $discountEntity)
 {
     if ($discountEntity->getVoucherPool()) {
         return $discountEntity->getVoucherPool();
     }
     $discountVoucherPoolEntity = $this->createVoucherPoolEntity();
     $this->hydrateVoucherPoolEntity($discountEntity, $discountVoucherPoolEntity);
     if ($discountEntity->getIdDiscount()) {
         $discountVoucherPoolEntity->save();
     }
     $discountEntity->setVoucherPool($discountVoucherPoolEntity);
     return $discountVoucherPoolEntity;
 }