コード例 #1
0
 private function getCoupon($couponType = 1, $discountType = 1)
 {
     $data = $this->getTestData($couponType, $discountType);
     $this->app['eccube.plugin.coupon.service.coupon']->createCoupon($data);
     /** @var \Plugin\Coupon\Entity\CouponCoupon $Coupon */
     $Coupon = $this->app['eccube.plugin.coupon.repository.coupon']->findOneBy(array('coupon_cd' => 'aaaaaaaa'));
     $Product = $this->app['eccube.repository.product']->find(1);
     $CouponDetail = new CouponCouponDetail();
     $CouponDetail->setCoupon($Coupon);
     $CouponDetail->setCouponType($Coupon->getCouponType());
     $CouponDetail->setUpdateDate($Coupon->getUpdateDate());
     $CouponDetail->setCreateDate($Coupon->getCreateDate());
     $CouponDetail->setDelFlg(Constant::ENABLED);
     $Categories = $Product->getProductCategories();
     /** @var \Eccube\Entity\ProductCategory $Category */
     $ProductCategory = $Categories[0];
     $CouponDetail->setCategory($ProductCategory->getCategory());
     $CouponDetail->setProduct($Product);
     $Coupon->addCouponDetail($CouponDetail);
     return $Coupon;
 }
コード例 #2
0
 /**
  * クポーン詳細情報を生成する
  * @param \Plugin\Coupon\Entity\CouponCoupon $coupon
  * @param \Plugin\Coupon\Entity\CouponCouponDetail $detail
  */
 protected function newCouponDetail(\Plugin\Coupon\Entity\CouponCoupon $coupon, \Plugin\Coupon\Entity\CouponCouponDetail $detail)
 {
     $couponDetail = new \Plugin\Coupon\Entity\CouponCouponDetail();
     $couponDetail->setCoupon($coupon);
     $couponDetail->setCouponType($coupon->getCouponType());
     $couponDetail->setUpdateDate($coupon->getUpdateDate());
     $couponDetail->setCreateDate($coupon->getCreateDate());
     $couponDetail->setCategory($detail->getCategory());
     $couponDetail->setProduct($detail->getProduct());
     $couponDetail->setDelFlg(Constant::DISABLED);
     return $couponDetail;
 }