1
votes

I have updated Typo3 v6.2.15 to 7.6.15 and tried to add namespaces to a custom Extension. Now im getting an error on the LoginController class:

Could not analyse class: "Tx_Verwaltung_Controller_LoginController" maybe not loaded or no autoloader? Class Tx_Verwaltung_Controller_LoginController does not exist

What i have done:

  • Replaced $_EXTKEY with 'DHW.' . $_EXTKEY in these files: ext_localconf.php, ext_tables.php Example:

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'DHW.' . $_EXTKEY,
        'login',
        array(
            'Login' => 'loginbox,logoutbox'
        ),
        array(      
            'Login' => 'loginbox,logoutbox'
        )
    );
    
  • added this in ext_emconfig.php:

    array(
        'classmap' => array('Classes'),
        'psr-4' => array('DHW\\Verwaltung\\' => 'Classes')
    ),
    
  • added this in composer.json:

    "autoload": {
        "psr-4": {
            "DHW\\Verwaltung\\": "Classes"
        }
    }
    
  • added namespace in typo3conf/ext/verwaltung/Classes/LoginController.php

    namespace DHW\Verwaltung\Controller;
    
    class Tx_Verwaltung_Controller_LoginController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { ... }
    
  • Disabled and Enabled the Extension in Backend.

  • Cleared caches in Backend.
  • Deleted typo3temp folder
  • Cleared caches with install tool.
1

1 Answers

0
votes

Solved it after reading this: How do I bootstrap a plugin on TYPO3 CMS 6.0 with extbase?

I had to add the vendorname in my Typoscript:

    loginBoxWidget = USER
    loginBoxWidget {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        vendorName    = DHW
        pluginName = login
        extensionName = Verwaltung
        controller = Login          
        action = loginbox

        ... 

After that i got an "Fatal error: Cannot declare class" error. After renaming the class Tx_Verwaltung_Controller_LoginController to LoginController everything worked.