[TYPO3-mvc] How to call an extbase controller within scheduler task

Sören Kracker s.kracker at kopfstand-mail.de
Fri Dec 2 10:05:29 CET 2011


Thank you, now it's getting called. But now I've got another problem. I 
have setup a mapping for a class in setup.txt, but that mapping isn't 
loaded. So I get the error message "table doesn't exist". How to pass 
plugin.tx_myext.persistence and plugin.tx_myext.settings to the 
bootstrap-run?
And is there anywhere a documentation about using scheduler with 
extbase? I can't find anything...

01.12.2011 17:43, Stefan Isak:
> Hi,
>
> try to include the following lines before you invoke $bootstrap->run(...).
>
> $_SERVER['REQUEST_METHOD'] = 'GET';
> $_GET['tx_myextension_plugin']['controller'] = 'MyController';
> $_GET['tx_myextension_plugin']['action'] = 'myAction';
> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Myextension']['modules']['Plugin']['controllers'] = array(
>    'MyController' =>  array(
>      'actions' =>  array(
>        'myAction'
>      )
>    )
> );
>
> That should do the trick.
>
> Cheers,
> Stefan
>
>
>
> On Dec 1, 2011, at 5:27 PM, Sören Kracker wrote:
>
>> Hi,
>> I need to call a controller of my extbase extension using a task of TYPO3 scheduler.
>> I always get following error (manually called in backend with admin user):
>> The default controller can not be determined. Please check for Tx_Extbase_Utility_Extension::configurePlugin() in your ext_localconf.php.
>>
>> My configurePlugin:
>>
>> Tx_Extbase_Utility_Extension::configurePlugin(
>>     $_EXTKEY,
>>     'Myplugin',
>>     array(
>>         'Mycontroller' =>  'list, import, show, new, create, edit, update, delete',
>>     ),
>>     // non-cacheable actions
>>     array(
>>         'Mycontroller' =>  'create, update, delete, import',
>>     )
>> );
>>
>>
>> Here's the scheduler class:
>>
>> class Tx_Myext_Utility_Scheduler extends tx_scheduler_Task {
>>     public function execute() {
>>         try {
>>             t3lib_div::devlog('--- working ---', 'myext', 0);
>>             $configuration = array(
>>                 'extensionName' =>  'Myext',
>>                 'pluginName' =>  'Myplugin',
>>                 'controller' =>  'Mycontroller',
>>                 'action' =>  'import',
>>                 'switchableControllerActions' =>  array(
>>                     'Mycontroller' =>  array(
>>                         'actions' =>  'import'
>>                     )
>>                 )
>>             );
>>             $bootstrap = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
>>             $bootstrap->run('', $configuration);
>>             return TRUE;
>>         }
>>         catch(Exception $e) {
>>             t3lib_div::devlog('--- error ---'.$e->getMessage(), 'myext', 0);
>>             return FALSE;
>>         }
>>     }
>> }
>>
>> I'm not sure if my bootstrap-call is correct. Maybe somebody got a working example how to do this?!
>>
>> Greetings,
>>
>> Sören
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list