Sylius / SyliusResourceBundle

Simpler CRUD for Symfony applications

Home Page:https://sylius.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow Custom HTTP Methods Configuration for CRUD Actions in Sylius Resource Bundle

julienromey opened this issue · comments

Title: Allow Configuration of HTTP Methods for CRUD Actions in Sylius Resource Bundle

Description:

Hello,

I'm experiencing an issue with the Sylius Resource Bundle when configuring CRUD operations. My current setup is:

my_entity:
    resource: |
        alias: my_entity
        templates: "@Templates/Folder"
        except: ['show']
    type: sylius.resource

For update actions, the my_entity_update route is restricted to GET|PUT|PATCH. However, we are sending POST requests. With Symfony 7, http_method_override will default to false, making this workaround unusable.

Suggestion:

Allow configuration of HTTP methods for CRUD actions in the resource configuration.
Reflect this configuration in the route definitions.
This enhancement will increase flexibility and compatibility with various request methods.

Thank you.

Hi, thanks for reporting this. It has already been fixed but you have to use the new 1.11 beta when' using the new routing system with php attributes. Please look at the documentation in the docs directory.