[TYPO3-mvc] Tx_Extbase_Dispatcher from hook in tslib_fe

Kevin Ulrich Moschallski km at 3digit.de
Thu Jul 8 15:20:34 CEST 2010


Hi list,

i currently try to dispatch my plugin from a hook in tslib_fe. I found a thread on the list from last year where somebody also tried this with the same error i currently get. There's no solution in the thread, because the user switched to a different approach.

First, what i want to implement is a geotargeting mechanism before the page is rendered, therefore i use the hook. The geotargeting runs and if it doesn't match any predefined values it should display a manual selection. This is where i want to display my extbase plugin.

Here is my code to dispatch the plugin:

$conf = array(
	'pluginName' => 'Pi1',
	'extensionName' => 'Geolocationrouter',
	'controller' => 'GeoLocations',
	'action' => 'index',
        'switchableControllerActions' => array (
		'1' => array('controller' => 'GeoLocations', 'actions' => 'index')
	)
      );

      
      
      $d = new Tx_Extbase_Dispatcher;
      $d->dispatch($feobj->content, $conf);

The error is:

#1: PHP Catchable Fatal Error: Argument 1 passed to Tx_Extbase_Configuration_FrontendConfigurationManager::setContentObject() must be an instance of tslib_cObj, null given, called in /Applications/MAMP/htdocs/dev/typo3conf/ext/extbase/Classes/Dispatcher.php on line 178 and defined in /Applications/MAMP/htdocs/dev/typo3conf/ext/extbase/Classes/Configuration/FrontendConfigurationManager.php line 45

setContentObject() complains that the given argument is not an instance of tslib_cObj, but when i do a var_dump on the object in the method (after removing the validation) it show up as an instanc of tslib_cobj.

My question now is, if anybody here ever tried this before or has an idea why the object isn't recognized correctly. Or maybe somebody has an different approach to what i'm trying to to.

Sadly, there i can't find anything helpful about this in the new book of Sebastian and Jochen, also it's a very nice book btw.

Thanks for help in advance.

Regards,

Kevin Moschallski



More information about the TYPO3-project-typo3v4mvc mailing list