repository = $repository; } /** * @param OrderObject $order * @return Order * @throws CannotCreateOrderException */ public function execute(OrderObject $order): ?Order { try { $this->repository->company_id = $order->getCompanyId(); $this->repository->marking = $order->getOrderId(); $this->repository->current_step = Constants::ORDER_PROCESSING_STEP; $this->repository->save(); return $this->repository; } catch (\Exception $exception){ throw new CannotCreateOrderException($exception->getMessage()); } } }