DunglasActionBundle
DunglasActionBundle copied to clipboard
[Doc] Provide best practices
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 theController
methods that did more than just proxy (likerender
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)?
+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!
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.