[TYPO3-dev] Best-practice: dependencies in Controllers

Steffen Müller typo3 at t3node.com
Wed Feb 12 10:54:38 CET 2014


Hi.

Without knowing what you want to achieve:
In general, injecting a controller into another controller has a bad
code smell. If you need the same logic within two controllers, you
should choose inheritance over composition. Put it into an abstract
controller and extend it.
If you like to delegate the request from one controller action to an
action of another controller, then use redirect() or forward().


-- 
cheers,
Steffen

Active Contributor TYPO3 CMS

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node



More information about the TYPO3-dev mailing list