src/Controller/UpdateController.php
public function update(Request $request, Section $section, ?string $owner = null)
    {
        $form = $this->createSettingForm($section, $owner ? $this->getUserSettings() : $this->getGlobalSettings());
        $config = $this->getRequestConfiguration($request);

        if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && $form->handleRequest($request)->isValid()) {
            $this->updateSettings($section, $form->getData(), $owner);

            if (!$config['isHtml']) {
                return JsonResponse::create(null, 204);
            }

            $this->addFlash('success', $this->createFlashTranslateMessage($config['flash']));

            return $this->createRedirectResponse($config['redirect']);
        }

        if ($owner) {
            $allSections = $this->get('phpmob.settings.schema_registry')->getOwners();
        } else {
            $allSections = $this->get('phpmob.settings.schema_registry')->getGlobals();
        }

        if (!$config['isHtml']) {
            return JsonResponse::create([
                'section' => $section,
                'sections' => $allSections,
            ]);
        }

        return $this->render($config['template'], [
            'section' => $section,
            'sections' => $allSections,
            'form' => $form->createView(),
        ]);
    }
public function update(Request $request, Section $section, ?string $owner = null)
    {
        $form = $this->createSettingForm($section, $owner ? $this->getUserSettings() : $this->getGlobalSettings());
        $config = $this->getRequestConfiguration($request);

        if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && $form->handleRequest($request)->isValid()) {
            $this->updateSettings($section, $form->getData(), $owner);

            if (!$config['isHtml']) {
                return JsonResponse::create(null, 204);
            }

            $this->addFlash('success', $this->createFlashTranslateMessage($config['flash']));

            return $this->createRedirectResponse($config['redirect']);
        }

        if ($owner) {
            $allSections = $this->get('phpmob.settings.schema_registry')->getOwners();
        } else {
            $allSections = $this->get('phpmob.settings.schema_registry')->getGlobals();
        }

        if (!$config['isHtml']) {
            return JsonResponse::create([
                'section' => $section,
                'sections' => $allSections,
            ]);
        }

        return $this->render($config['template'], [
            'section' => $section,
            'sections' => $allSections,
            'form' => $form->createView(),
        ]);
    }
@param Request $request
@param Section $section
@param null|string $owner

@return Response