/**
  * @return bool
  */
 public function execute()
 {
     $success = TRUE;
     $this->requiredInjects();
     $unworkedOrders = $this->orderRepository->findUnworkedOrders();
     foreach ($unworkedOrders as $order) {
         $orderingUser = $this->userRepository->findById($order->getUser());
         $this->createBill($order, $orderingUser);
         $this->setOrderToWorked($order);
         break;
     }
     return $success;
 }
 /**
  * @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;
 }