/** * {@inheritdoc} */ public function denormalize($data, $class, $format = null, array $context = array()) { if (array_key_exists('paymentDetails', $data)) { $data['paymentDetails'] = $this->importHelper->denormalizePaymentDetails($data['paymentDetails']); } /** @var Order $order */ $order = parent::denormalize($data, $class, $format, $context); $integration = $this->importHelper->getIntegrationFromContext($context); $order->setChannel($integration); $order->setDataChannel($this->channelImportHelper->getChannel($integration)); if ($order->getStore()) { $order->getStore()->setChannel($integration); } return $order; }
/** * {@inheritdoc} */ public function denormalize($data, $class, $format = null, array $context = array()) { if (array_key_exists('paymentDetails', $data)) { $data['paymentDetails'] = $this->importHelper->denormalizePaymentDetails($data['paymentDetails']); } /** @var Cart $cart */ $cart = parent::denormalize($data, $class, $format, $context); $integration = $this->importHelper->getIntegrationFromContext($context); $cart->setChannel($integration); $cart->setDataChannel($this->channelImportHelper->getChannel($integration)); if ($cart->getStore()) { $cart->getStore()->setChannel($integration); } if (!empty($data['email'])) { $cart->getCustomer()->setEmail($data['email']); } $this->updateStatus($cart, $data); return $cart; }
/** * @param array $context * * @return Integration * @throws \LogicException */ protected function getIntegrationFromContext(array $context) { return $this->importHelper->getIntegrationFromContext($context); }