Quite simply, an action can interrogate where it was called from, what
post/get data exists as well as what session data exists. All of this can be
used to help determine what function an action should perform. Once you can
determine inside an action what you need to do you can also load different
templates based on what you need to return the user by using function such
as setTemplate(), renderPartial(), redirect() and forward(). I use this a
lot where I have one action that performs two functions, one to prepare the
forms class to display to a user, followed by a form processor if the form
was posted.

On Sun, Jan 2, 2011 at 9:36 AM, benze <ebenza...@gmail.com> wrote:

> Hi,
>
> I'm trying to figure out the best way to reuse an action, and am
> having difficulty figuring that out.  Specifically because my action
> seems to be tied to the response.
>
> For instance, I have a delete action that I want to call from within
> several different web pages, however, depending on which page is
> calling the delete action, I want to redirect the user to a different
> page once complete.  I'm not quite sure if/how to do that.
>
> If I compare to Java Struts2, I am able to split action definition and
> workflow by using an xml file that indicates how to process the
> results of my action (ie: upon Success, do X, or Y, etc).  And
> furthermore, I can create a different action name that reuses the same
> Action code but has different workflow based on the result.
>
> I know/realize that php/symfony is not Java/Struts2.  But is there
> somehow I can reuse my action without needing to superclass/subclass
> all the time?  That just ends up causing a lot of action naming
> grief...
>
> Thanks!
>
> Eric
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to