コード例 #1
0
 /**
  * @param \Generated\Shared\Transfer\DiscountCalculatorTransfer|null $value
  *
  * @return \Generated\Shared\Transfer\DiscountCalculatorTransfer|null
  */
 public function reverseTransform($value)
 {
     if (!$value || !$value->getCalculatorPlugin()) {
         return null;
     }
     $calculatorPlugin = $this->getCalculatorPlugin($value->getCalculatorPlugin());
     $transformedAmount = $calculatorPlugin->transformForPersistence($value->getAmount());
     $value->setAmount($transformedAmount);
     return $value;
 }
コード例 #2
0
 /**
  * @return \Generated\Shared\Transfer\DiscountCalculatorTransfer
  */
 protected function createDiscountCalculatorTransfer()
 {
     $calculatedDiscountTransfer = new DiscountCalculatorTransfer();
     $calculatedDiscountTransfer->setCalculatorPlugin(DiscountDependencyProvider::PLUGIN_CALCULATOR_FIXED);
     return $calculatedDiscountTransfer;
 }
コード例 #3
0
 /**
  * @param \Orm\Zed\Discount\Persistence\SpyDiscount $discountEntity
  *
  * @return \Generated\Shared\Transfer\DiscountCalculatorTransfer
  */
 protected function hydrateDiscountCalculator(SpyDiscount $discountEntity)
 {
     $discountCalculatorTransfer = new DiscountCalculatorTransfer();
     $discountCalculatorTransfer->fromArray($discountEntity->toArray(), true);
     return $discountCalculatorTransfer;
 }