diff --git a/.gitignore b/.gitignore index ea8d6aa9..43469c37 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ /dev.php /install.php /clear_cache.php -/pimple.json /assets project_env.sh diff --git a/composer.json b/composer.json index d80eb6b9..72c54569 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,6 @@ "guzzlehttp/guzzle": "^7.2.0", "jms/serializer": "^3.9.0", "league/flysystem": "^3.0", - "pimple/pimple": "^3.3.1", "ramsey/uuid": "^4.7", "roadiz/compat-bundle": "2.3.x-dev", "roadiz/core-bundle": "2.3.x-dev", diff --git a/src/Controllers/Nodes/NodesAttributesController.php b/src/Controllers/Nodes/NodesAttributesController.php index d11e3ecd..5df37df3 100644 --- a/src/Controllers/Nodes/NodesAttributesController.php +++ b/src/Controllers/Nodes/NodesAttributesController.php @@ -14,6 +14,7 @@ use RZ\Roadiz\CoreBundle\Event\NodesSources\NodesSourcesUpdatedEvent; use RZ\Roadiz\CoreBundle\Form\AttributeValueTranslationType; use RZ\Roadiz\CoreBundle\Form\AttributeValueType; +use RZ\Roadiz\CoreBundle\Form\Error\FormErrorSerializer; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormFactoryInterface; @@ -26,8 +27,10 @@ class NodesAttributesController extends RozierApp { - public function __construct(private readonly FormFactoryInterface $formFactory) - { + public function __construct( + private readonly FormFactoryInterface $formFactory, + private readonly FormErrorSerializer $formErrorSerializer + ) { } /** @@ -126,7 +129,7 @@ public function editAction(Request $request, int $nodeId, int $translationId): R 'translationId' => $translation->getId(), ]); } else { - $errors = $this->getErrorsAsArray($attributeValueTranslationForm); + $errors = $this->formErrorSerializer->getErrorsAsArray($attributeValueTranslationForm); /* * Handle errors when Ajax POST requests */ diff --git a/src/Controllers/Tags/TagsController.php b/src/Controllers/Tags/TagsController.php index f5fd8a81..9a766e71 100644 --- a/src/Controllers/Tags/TagsController.php +++ b/src/Controllers/Tags/TagsController.php @@ -15,6 +15,7 @@ use RZ\Roadiz\CoreBundle\Event\Tag\TagDeletedEvent; use RZ\Roadiz\CoreBundle\Event\Tag\TagUpdatedEvent; use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; +use RZ\Roadiz\CoreBundle\Form\Error\FormErrorSerializer; use RZ\Roadiz\CoreBundle\Repository\TranslationRepository; use RZ\Roadiz\Utils\StringHandler; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -41,6 +42,7 @@ class TagsController extends RozierApp public function __construct( private readonly FormFactoryInterface $formFactory, + private readonly FormErrorSerializer $formErrorSerializer, private readonly HandlerFactoryInterface $handlerFactory, private readonly TreeWidgetFactory $treeWidgetFactory ) { @@ -202,7 +204,7 @@ public function editTranslatedAction(Request $request, int $tagId, ?int $transla * Handle errors when Ajax POST requests */ if ($isJsonRequest) { - $errors = $this->getErrorsAsArray($form); + $errors = $this->formErrorSerializer->getErrorsAsArray($form); return new JsonResponse([ 'status' => 'fail', 'errors' => $errors, @@ -397,7 +399,7 @@ public function editSettingsAction(Request $request, int $tagId): Response * Handle errors when Ajax POST requests */ if ($isJsonRequest) { - $errors = $this->getErrorsAsArray($form); + $errors = $this->formErrorSerializer->getErrorsAsArray($form); return new JsonResponse([ 'status' => 'fail', 'errors' => $errors, diff --git a/src/RozierApp.php b/src/RozierApp.php index b1b395a7..412b116e 100644 --- a/src/RozierApp.php +++ b/src/RozierApp.php @@ -103,10 +103,7 @@ protected function getNamespacedView(string $view, string $namespace = ''): stri return $view; } - /** - * @return $this - */ - public function prepareBaseAssignation() + public function prepareBaseAssignation(): static { parent::prepareBaseAssignation(); /*