Call Symfony Task from Action

Discussion relating to version 1.3.x and 1.4.x

Call Symfony Task from Action

Postby riczan » Tue May 29, 2012 12:12 pm

Hi,

is it possible to call an existing Symfony Task e.g from an action?

I dont want to do this with the terminal.

thanks...:)
riczan
Junior Member
 
Posts: 2
Joined: Mon Feb 28, 2011 3:24 pm

Re: Call Symfony Task from Action

Postby aroncal » Mon Jun 04, 2012 11:02 am

I did it this way

Code: Select all
    public function executeSyncDocuments(sfWebRequest $request) {
       
       chdir(sfConfig::get('sf_root_dir')); // Trick plugin into thinking you are in a project directory
       $task = new SyncCNToCMSDocumentsTask($this->dispatcher, new sfFormatter());
       $task->run(
          array( //arguments
             'erp-codes' =>  $request->getParameter('erpCodes')
          ),
          array( //options
             'update',
             'env' =>  sfConfig::get('sf_environment'),
          )
       );
       .......
    }
aroncal
Junior Member
 
Posts: 3
Joined: Thu Mar 15, 2012 11:53 am


Return to symfony 1.3 and 1.4

Who is online

Users browsing this forum: No registered users and 7 guests