[TYPO3-mvc] Which logic belongs to the controller?
Jochen Rau
jochen.rau at typoplanet.de
Tue Jan 12 23:50:09 CET 2010
Hi Masi.
On 12.01.10 12:13, Martin Kutschker wrote:
> The MVC pattern puts business logic (that is not intrinsic to the models themselves) into the
> controller. Now the controller base class of ExtBase is built to accept parameters from an HTTP request.
IMO there is no business logic inside a controller. If it's not is not
intrinsic to the Domain Model I would put it into a Domain Service.
> But how about other scenarios? I'm thinking of CLI scripts, SOAP servers etc. The former would need
> a different controller to get the parameters from the command line (or the environment). The latter
> would need to parse the SOAP body (after a specialized dispatcher found the right controller by
> parsing the SOAP header).
In FLOW3 there is already a RequestBuilder for CLI Requests (subpackage
MVC of FLOW3) and a RESTController. Let's backport it for four four ;-)
Isn't there already a corresponding feature request?
> Which brings up the question of choosing views. All examples can probably be implemented with FLUID,
> But what about those where it is not possible? Can the controller choose the view? Or do I need
> different controllers for each "type" of view?
You just have to put an own view class inside your extension. If the
class name follows the pattern
Tx_ at extension_View_@controller_ at action@format
and extends Tx_Extbase_MVC_View_AbstractView, it will automatically
loaded and invoked.
You can overload the method
Tx_Extbase_MVC_Controller_ActionController::resolveView() to have full
freedom.
Regards
Jochen
More information about the TYPO3-project-typo3v4mvc
mailing list