Sylius / SyliusResourceBundle

Simpler CRUD for Symfony applications

Home Page:https://sylius.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] The HttpFoundationRequestHandler class is not compatible with some form usages

Nek- opened this issue · comments

Sylius version affected: all

Description

Some standard usage of the form component of Symfony leads to issues with the HttpFoundationRequestHandler.php provided by the bundle.

This part of the code seems to be the issue:

// Don't submit GET requests if the form's name does not exist
// in the request
if (!$request->query->has($name)) {
return;
}

Steps to reproduce

Consider I want to validate an input using a form and validator for a simple input (in this example, to access URL foo/bar?search=something). I can do this with Symfony:

        $form = $this->formFactory->createNamedBuilder('search', EntityType::class, null, [
            'method' => 'GET',
            'constraints' => [new NotNull(), new CustomValidation()],
            'class' => Retailer::class,
            'csrf_protection' => false,
        ])->getForm();

It's not working with the SyliusResourceBundle activated.

Possible Solution

Remove the class that overrides Symfony behavior? (I've no idea what it fixes)