Sylius / SyliusResourceBundle

Simpler CRUD for Symfony applications
https://sylius.com
MIT License
219 stars 155 forks source link

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

Open julienromey opened 4 months ago

julienromey commented 4 months ago

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.

loic425 commented 4 months ago

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.

loic425 commented 4 months ago

https://github.com/Sylius/SyliusResourceBundle/blob/1.11/docs/configure_your_operations.md#update-operation