$orderSynchronizer->getOrderRealizeData($order), 'invoice' => $orderSynchronizer->getOrderInvoiceData($order), ]; break; default: $data = $orderSynchronizer->getOrderData($order); } return new JsonResponse( $data ); } /** * @Route("/_flexi/{type}/") */ public function syncType(FlexiBeeLocator $locator, string $type): JsonResponse { try { $synchronizer = $locator->getServiceByType($type); $synchronizer->sync(); } catch (FlexiBeeException $e) { return new JsonResponse(['success' => false, 'message' => $e->getMessage()]); } return new JsonResponse(['success' => true, 'message' => sprintf('Synchronization of "%s" done', $type)]); } /** * @Route("/_flexi/{type}/{id}/") */ public function syncSingleItem(FlexiBeeLocator $locator, string $type, int $id): JsonResponse { try { $synchronizer = $locator->getServiceByType($type); $synchronizer->syncSingleItem($id); } catch (FlexiBeeException $e) { return new JsonResponse(['success' => false, 'message' => $e->getMessage()]); } return new JsonResponse(['success' => true, 'message' => 'Single item synchronization completed']); } }