/** * @return \WHO\WhoShop\Domain\Model\Order * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ private function saveOrder() { $newOrder = new \WHO\WhoShop\Domain\Model\Order(); $newOrder->setUser($this->frontendUserRepository->findById($GLOBALS['TSFE']->fe_user->user['uid'])); $newOrder->setOrderDate(time()); $newOrder->setState(1); $this->orderRepository->add($newOrder); $this->persistenceManager->persistAll(); foreach ($this->basketHandler->getOrder() as $productUid => $orderParams) { if ($productUid == 'count') { continue; } $newOrderItem = new \WHO\WhoShop\Domain\Model\OrderItem(); $newOrderItem->setOrderSize($orderParams['orderSize']); $newOrderItem->setorderValue($orderParams['orderValue']); DebuggerUtility::var_dump($productUid); $newOrderItem->addProduct($this->productRepository->findById($productUid)->getFirst()); $this->orderItemRepository->add($newOrderItem); $this->persistenceManager->persistAll(); $newOrder->addOrderItem($newOrderItem); $this->orderRepository->update($newOrder); $this->persistenceManager->persistAll(); } return $newOrder; }
private function setOrderToWorked(\WHO\WhoShop\Domain\Model\Order $order) { $order->setState(2); $this->orderRepository->update($order); $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface')->persistAll(); }