Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I bootstrap a plugin on TYPO3 CMS 6.0 with extbase?

I'm trying to use an extbase plugin through typoscript on TYPO3 CMS 6.0. I used the following code, that I found repeated all over the web:

10 = USER
10 { 
    userFunc = tx_extbase_core_bootstrap->run
    pluginName = Sermons
    extensionName = VmfdsSermons
    switchableControllerActions {
        Sermon {
            1 = byLatestSeries
            2 = list
            3 = show
    }
}

However, this just gives me the following error:

#1289386765: Could not analyse class:Tx_VmfdsSermons_Controller_SermonController maybe not loaded or no autoloader?

It seems to me as if tx_extbase_core_bootstrap->run is not using namespaces yet, thus trying to load a class called Tx_VmfdsSermons_Controller_SermonController when it should have called \TYPO3\VmfdsSermons\Controller\SermonController. Is there a way around this?

like image 383
Christoph Fischer Avatar asked Dec 27 '12 21:12

Christoph Fischer


2 Answers

You're searching for the property vendorName. So in your case it should be:

10 = USER
10 { 
    userFunc      = TYPO3\CMS\Extbase\Core\Bootstrap->run

    pluginName    = Sermons
    extensionName = VmfdsSermons
    vendorName    = TYPO3
    [...]

I also used the vendor namespace within ext_localconf.php:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    '<Vendor>.' . $_EXTKEY, 
    [...]

I found the answer by using the debugger. I started at \TYPO3\CMS\Extbase\Mvc\Dispatcher::resolveController() and jumped into TYPO3\CMS\Extbase\Mvc\Request::getControllerObjectName(). There is a member controllerVendorName, so I searched in Extbase for the setter of \TYPO3\CMS\Extbase\Mvc\Request::setControllerVendorName(), precisely just for setControllerVendorName, and got a match in \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::build(), where is a member called vendorName, and just in the method above \TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::loadDefaultValues(), is the answer!

like image 173
witrin Avatar answered Sep 20 '22 02:09

witrin


Calling tx_extbase_core_bootstrap should no longer be used as it is deprecated in ver. 6.0 and will be removed in 7.0

You can try different. Developers should now handle everything with namespaces ...

You can use this:

# bootstrap aufrufen -> run from extbase

userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
like image 41
til.tack Avatar answered Sep 22 '22 02:09

til.tack