[TYPO3-ect] symfony

Michael Scharkow michael at underused.org
Fri Feb 10 09:11:31 CET 2006


Elmar Hinz wrote:

> A full request consists of 3 Phases:
> 
> 1.) Checks and saving of the last form.
> 2.) Decision what comes next. (This could depend from the last form data i.e.)
> 3.) Display of the next view/form. (If checks failed it is the last one.)
> 
> In my extensions I often reset the action ($cmd) in 2.) and call the controller
> with this a second time for 3.) Ernesto has proposed to set a new Location
> header for 3.).

Ernesto is right. You call save(), do stuff (like saving...), redirect 
to another action (list(), or success()), in PHP through 
header('Location: blah'), although I'd implement a simpler redirect 
method that does redirect_to('success'). It would be nicer to parse 
actions from the URL rather than the $cmd variable.  I did not implement 
this but it should be possible without too much effort.

> How can it be solved with your proposed controller. I guess both technics are
> possible. Am I right? Has $this->filtered[$cmd] something to do with it?

It works just like that, although without the convenience. The $filtered 
array is for definining actions which depend on some condition which is 
checked in the defined method. If editing is only for logged_in users 
you'd set $this->filtered('edit'=>'authorized') and create a method 
authorized which returns true only if fe_user is logged in. For this 
standard case, I'd of course provide a method in the controller class.

Notice that the code for an actual controller would be even shorter 
because you only define the exposed array and the required methods.

Cheers,
Michael



More information about the TYPO3-team-extension-coordination mailing list