コード例 #1
0
 /**
  * @param string $decisionRuleQueryString
  * @param string $collectorQueryString
  * @param string $discountType
  *
  * @return \Orm\Zed\Discount\Persistence\SpyDiscount
  */
 protected function createDiscountFixtures($decisionRuleQueryString, $collectorQueryString, $discountType = DiscountConstants::TYPE_CART_RULE)
 {
     $discountVoucherPool = new SpyDiscountVoucherPool();
     $discountVoucherPool->setIsActive(true);
     $discountVoucherPool->setName('test');
     $discountVoucherPool->save();
     $discountEntity = new SpyDiscount();
     $discountEntity->setAmount(100);
     $discountEntity->setFkDiscountVoucherPool($discountVoucherPool->getIdDiscountVoucherPool());
     $discountEntity->setDecisionRuleQueryString($decisionRuleQueryString);
     $discountEntity->setCollectorQueryString($collectorQueryString);
     $discountEntity->setDisplayName('display name');
     $discountEntity->setCalculatorPlugin(DiscountDependencyProvider::PLUGIN_CALCULATOR_FIXED);
     $discountEntity->setDiscountType($discountType);
     $discountEntity->setIsActive(1);
     $discountEntity->setValidFrom(new \DateTime('yesterday'));
     $discountEntity->setValidTo(new \DateTime('tomorrow'));
     $discountEntity->save();
     return $discountEntity;
 }
コード例 #2
0
ファイル: DiscountPersist.php プロジェクト: spryker/Discount
 /**
  * @param \Generated\Shared\Transfer\DiscountConfiguratorTransfer $discountConfiguratorTransfer
  * @param \Orm\Zed\Discount\Persistence\SpyDiscount $discountEntity
  *
  * @return void
  */
 protected function hydrateDiscountEntity(DiscountConfiguratorTransfer $discountConfiguratorTransfer, SpyDiscount $discountEntity)
 {
     $discountEntity->fromArray($discountConfiguratorTransfer->getDiscountGeneral()->toArray());
     $discountEntity->setAmount($discountConfiguratorTransfer->getDiscountCalculator()->getAmount());
     $discountEntity->setCalculatorPlugin($discountConfiguratorTransfer->getDiscountCalculator()->getCalculatorPlugin());
     $discountEntity->setCollectorQueryString($discountConfiguratorTransfer->getDiscountCalculator()->getCollectorQueryString());
     $discountEntity->setDecisionRuleQueryString($discountConfiguratorTransfer->getDiscountCondition()->getDecisionRuleQueryString());
 }