I am trying to figure out what is the best way to design my urls. So here is what I have done so far:
account_index:
pattern: /Accounts/
defaults: { _controller: "CoreBundle:Account:index" }
requirements: { _method: get }
account_create:
pattern: /Accounts/
defaults: { _controller: "CoreBundle:Account:create" }
requirements: { _method: post }
account_read:
pattern: /Accounts/{id}
defaults: { _controller: "CoreBundle:Account:show" }
requirements: { _method: get }
account_update:
pattern: /Accounts/{id}
defaults: { _controller: "CoreBundle:Account:update" }
requirements: { _method: put }
account_delete:
pattern: /Accounts/{id}
defaults: { _controller: "CoreBundle:Account:delete" }
requirements: { _method: delete }
After testing what I did, I realized that updating and deleting do not work (always causes account_read) ... After I tried to solve my problem, it turned out that the PUT and DELETE methods are not supported in all browsers ... and may be omitted in the future.
Then I read that Ruby on rails supports these two methods in all browsers, doing magic.
So I wonder if Symfony2 can handle PUT and DELETE like a ruby? AND ALSO Should I use a residual url at all?
source