[TYPO3-mvc] Tx_Extbase_Dispatcher from hook in tslib_fe

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jul 8 15:32:35 CEST 2010


Hi,

> 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.

Having a look at the according line 178 you would have noticed, that 
"$this->cObj" is passed to setContentObject, but $this->cObj is in your 
case NULL. The first argument of the dispatch method is NOT the cObject. 
The cObject is set from the outside by TYPO3 by default. So try this:

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


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list