[TYPO3-mvc] Scheduler & ext_base?

Michael Feinbier mf at hdnet.de
Mon Jul 26 17:01:30 CEST 2010


Hi Braulio,

I am using Extbase from a scheduler task like this:

class Tx_Hettich_Service_PressSubscriptionScheduler extends 
tx_scheduler_Task {
	
	/**
	 * Macht eigentlich nichts weiter als ExtBase aufrufen
	 * Presse->notify
	 *
	 * @return boolean
	 * @see    typo3/sysext/scheduler/tx_scheduler_Task::execute()
	 */
	public function execute() {
		$configuration = array(
			'extensionName' => 'hettich',
			'action' => 'notify',
			'controller' => 'Presse',
			'switchableControllerActions' => array(
				array('controller' => 'Presse', 'actions' => 'notify')
			)
		);
		
		$dispatcher = new Tx_Extbase_Dispatcher();
		$dispatcher->dispatch('', $configuration);
		
		return true;
	}
}

This works fine for me but as already mentioned this is just a kind of 
hack because it is no "real" HTTP-Request.

Hope, that helps

Micha


Am 22.07.10 21:42, schrieb Braulio J. Solano-Rojas:
> Hello.
>
> I would like to know if it is possible to dispatch a controller inside a
> task (before I try). I would like to do something like this:
>
> class Tx_Magazine_Task_EmailTask extends tx_scheduler_Task {
> public function execute() {
> // Create a Tx_Extbase_MVC_Request $request object.
> // Set parameters for request.
> // Create a response object $response.
> $controller =
> t3lib_div::makeInstance('Tx_Extbase_MVC_Controller_ActionController');
> $controller.processRequest($request, $response);
> // use t3lib_div to email $response.getContent();
> return True;
> }
> }
>
> Am I understanding fine the API?
>
> I will appreciate very much any help.
>
> Best regards,
>
> B.



More information about the TYPO3-project-typo3v4mvc mailing list