2009年3月31日星期二

Re: [fw-mvc] headless controllers

Is your background task going to run in a browser or as a cronjob?

Also, note that you can instantiate your controllers manually. You just need to pass in valid request/response objects. This works out very well for cron jobs, which I have done in the past to generate/send daily newsletters.

-Hector


On Tue, Mar 31, 2009 at 1:27 PM, Seth Atkins <satkins@nortel.com> wrote:
I can't seem to find a lot of documentation on how one would typically implement a controller without a view. Yes, turning off the view is easy, but not my question.
 
Suppose I have a background task that I want to run under certain conditions. Call it controller1/action1. And after it is done, suppose I want it to go to controller2/index. Is the typical implementation to chain these together through redirects?
Like:
class controller1 extends ActionController
{
    function action1Action()
    {
    //do something
    $this->_redirect('/controller2/index');
    }
}
 
Or is it prefered to chain them together in the dispatch chain using custom pre/post dispatch methods?
 
I know ZF has the flexibility to do it many ways, just trying to get an idea of the pros/cons of the different ways.
 

Seth


没有评论: