我已将Typo3 v6.2.15更新到7.6.15,并尝试将名称空间添加到自定义扩展。现在即时通讯上的LoginController类得到一个错误:“无法分析类:可能没有加载或没有自动加载器?”
Could not analyse class: "Tx_Verwaltung_Controller_LoginController" maybe not loaded or no autoloader? Class Tx_Verwaltung_Controller_LoginController does not exist
我做了什么:
使用这些文件中
'DHW.' . $_EXTKEY
替换$_EXTKEY
:ext_localconf.php,ext_tables.php 例子:\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'DHW.' . $_EXTKEY, 'login', array( 'Login' => 'loginbox,logoutbox' ), array( 'Login' => 'loginbox,logoutbox' ) );
在ext_emconfig.php中加入了这个:
array( 'classmap' => array('Classes'), 'psr-4' => array('DHW\\Verwaltung\\' => 'Classes') ),
加入这composer.json:
"autoload": { "psr-4": { "DHW\\Verwaltung\\": "Classes" } }
- 在typo3conf/EXT/VERWALTUNG /类
添加命名空间/ LoginController.php
namespace DHW\Verwaltung\Controller; class Tx_Verwaltung_Controller_LoginController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { ... }
Enabled和Disabled在后端扩展。
- 清除后端缓存。
- 删除typo3temp文件夹
- 使用安装工具清除缓存。