Controller/WidgetController.php
public function order(Request $request, WidgetInterface $widget, string $widgetId, int $order)
    {
        // Build Widget
        $widgets = $widget->getWidgets();

        if (isset($widgets[$widgetId])) {
            // Get User Widgets
            $widgetConfig = $this->getDoctrine()
                    ->getRepository('PdWidgetBundle:WidgetUser')
                    ->findOneBy(['owner' => $this->getUser()]) ?? (new WidgetUser())->setOwner($this->getUser());

            // Add Config Parameters
            $widgetConfig->addWidgetConfig($widgetId, ['order' => $order]);

            // Save
            $em = $this->getDoctrine()->getManager();
            $em->persist($widgetConfig);
            $em->flush();
        }

        // Response
        return $this->json([
            'result' => 'success',
        ]);
    }
public function order(Request $request, WidgetInterface $widget, string $widgetId, int $order)
    {
        // Build Widget
        $widgets = $widget->getWidgets();

        if (isset($widgets[$widgetId])) {
            // Get User Widgets
            $widgetConfig = $this->getDoctrine()
                    ->getRepository('PdWidgetBundle:WidgetUser')
                    ->findOneBy(['owner' => $this->getUser()]) ?? (new WidgetUser())->setOwner($this->getUser());

            // Add Config Parameters
            $widgetConfig->addWidgetConfig($widgetId, ['order' => $order]);

            // Save
            $em = $this->getDoctrine()->getManager();
            $em->persist($widgetConfig);
            $em->flush();
        }

        // Response
        return $this->json([
            'result' => 'success',
        ]);
    }
Change Widget Order.

@param Request $request
@param string  $widgetId
@param int     $order

@return \Symfony\Component\HttpFoundation\JsonResponse