DunglasActionBundle icon indicating copy to clipboard operation
DunglasActionBundle copied to clipboard

[Doc] Provide best practices

Open backbone87 opened this issue 7 years ago • 2 comments

Imho it would be useful, if there are best practice documentation available. When using this bundle with the API platform, some more specific examples are provided in the API platform doc. However when using this bundle in "classic" apps with server generated views and you come from "classic" Symfony controller (and extending FrameworkBundle's Controller) there is almost no usage hints/best practice available.

Some questions that immediately popped to my mind, when i first started evaluating this bundle:

  • What do i use insteadof Controller::render? Should i use template annotations (Symfony best practice does not recommend it)?
  • Obviously where Controller just proxied a service method, you can now easily use autowired service injection and use the service directly, but what about the Controller methods that did more than just proxy (like render from above, forward, denyAccessUnlessGranted and all the others)?
  • Should i use/create an AbstractAction/CommonActionTrait which provides common action tasks?
  • How would an AbstractAction/CommonActionTrait be wired? Manually or auto? Setter or contructor (or getter)?

backbone87 avatar Apr 09 '17 16:04 backbone87

+1 especially for the CommonActionTrait. I have read something in the past that some people worked on it. Actually is there a trait to include basic controller behaviors ? Like $this->render() or $this->getDoctrine() ?

Thank you!

ksom avatar May 01 '17 17:05 ksom

btw. symfony 3.3 has built in support for very similar features provided by this bundle. you can read up in the official symfony blog about it.

backbone87 avatar May 01 '17 17:05 backbone87