PHP Typo3 4.7 基于 extbase 的扩展中的错误 "Cannot redeclare class"

PHP error "Cannot redeclare class" in extbase-based extension of Typo3 4.7

我使用 extbase 框架为 Typo3 4.7 创建了一个扩展(实际上,它是为 Typo3 6.2 创建的,但我正在尝试向后移植它)。我已经从核心中删除了所有名称空间并检查了 TYPO3 - Call another repository。但是,我遇到调用前端插件导致 PHP 错误 PHP Fatal error: Cannot redeclare class [...]\ProjectController in [...]/ProjectController.php on line 127 的问题(第 127 行是 class 的右大括号)。在我的插件中,我没有任何 require/include 除了 "dynamicConfigFile"s.

有问题的控制器使用这样的依赖注入:

/**
 * projectRepository
 *
 * @var Tx_MyExtension_Domain_Repository_ProjectRepository
 * @inject
 */
protected $projectRepository = NULL;

/**
 * sfbRepository 
 *
 * @var Tx_myExtension_Domain_Repository_SFBRepository
 * @inject
 */
protected $sfbRepository = NULL;

我是 运行 PHP 5.5.14。如果我将 "Tx_..." 内容改为使用名称空间,则整个代码适用于 Typo3 6。

到目前为止,我只找到一个关于这个问题的网站 (https://forum.typo3.org/index.php/t/203725/),它说使用依赖注入而不是 t3lib_div::makeInstance 已经解决了这个问题。但是,我已经在使用依赖注入了。

此外,如果我在 class 的声明之前添加 print_r(get_declared_classes());,它 不会 打印有问题的 class,即好像没申报。

有没有人遇到过这样的问题?我还能做些什么来解决这个问题?

编辑:整个堆栈跟踪是

[Mon Apr 27 17:17:17 2015] [error] [client ] PHP Stack trace:
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   1. {main}() /srv/www/typo3_src-4.7.11/index.php:0
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   2. require() /srv/www/typo3_src-4.7.11/index.php:76
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   3. include() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/index_ts.php:353
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   4. TSpagegen::renderContent() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/pagegen.php:74
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   5. tslib_cObj->cObjGet() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_pagegen.php:259
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   6. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   7. tslib_content_User->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   8. tslib_cObj->callUserFunction() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_user.php:55
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP   9. call_user_func_array:{/srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584}() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  10. tx_templavoila_pi1->main_page() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  11. tx_templavoila_pi1->renderElement() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:196
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  12. tx_templavoila_pi1->processDataValues() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:331
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  13. tslib_cObj->cObjGet() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:605
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  14. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  15. tslib_content_Records->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  16. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_records.php:124
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  17. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:600
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  18. tslib_content_Case->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  19. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_case.php:52
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  20. tslib_content_ContentObjectArray->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  21. tslib_cObj->cObjGet() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_contentobjectarray.php:48
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  22. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  23. tslib_content_Case->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  24. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_case.php:52
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  25. tslib_content_User->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  26. tslib_cObj->callUserFunction() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_user.php:55
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  27. call_user_func_array:{/srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584}() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  28. Tx_Extbase_Core_Bootstrap->run() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  29. Tx_Extbase_Core_Bootstrap->handleWebRequest() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Core/Bootstrap.php:212
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  30. Tx_Extbase_MVC_Web_FrontendRequestHandler->handleRequest() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Core/Bootstrap.php:242
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  31. Tx_Extbase_MVC_Dispatcher->dispatch() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php:85
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  32. Tx_Extbase_MVC_Dispatcher->resolveController() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Dispatcher.php:94
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  33. Tx_Extbase_Object_ObjectManager->get() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Dispatcher.php:114
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  34. Tx_Extbase_Object_Container_Container->getInstance() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/ObjectManager.php:109
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  35. Tx_Extbase_Object_Container_Container->getInstanceInternal() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/Container.php:120
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  36. Tx_Extbase_Object_Container_Container->getClassInfo() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/Container.php:159
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  37. Tx_Extbase_Object_Container_ClassInfoFactory->buildClassInfoFromClassName() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/Container.php:345
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  38. ReflectionClass->__construct() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php:43
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  39. spl_autoload_call() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php:43
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  40. t3lib_autoloader::autoload() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Object/Container/ClassInfoFactory.php:43
[Mon Apr 27 17:17:17 2015] [error] [client ] PHP  41. t3lib_div::requireFile() /srv/www/typo3_src-4.7.11/t3lib/class.t3lib_autoloader.php:97

编辑: 与此同时,我尝试使用命名空间并删除它们——两种情况下的结果都是一样的。此外,删除依赖注入也没有效果。如果我在声明周围添加 !class_exists() 检查,脚本不会崩溃,但会引发异常并且 Typo3 抱怨 class 未在日志中定义。几乎就好像 class 以某种方式存在,但不能使用或有所不同...

编辑: 我现在已经重命名(希望)所有 classes 和注释以匹配 extbase 命名方案。但是,错误已移,调用堆栈现在如下所示:

[Tue Apr 28 15:33:52 2015] [error] [client ] PHP Fatal error:  Cannot redeclare class Tx_MyExtension_Model_Domain_Project in /srv/www/html/typo3conf/ext/my_extension/Classes/Domain/Model/Project.php on line 383
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP Stack trace:
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   1. {main}() /srv/www/typo3_src-4.7.11/index.php:0
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   2. require() /srv/www/typo3_src-4.7.11/index.php:76
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   3. include() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/index_ts.php:353
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   4. TSpagegen::renderContent() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/pagegen.php:74
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   5. tslib_cObj->cObjGet() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_pagegen.php:259
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   6. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   7. tslib_content_User->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   8. tslib_cObj->callUserFunction() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_user.php:55
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP   9. call_user_func_array:{/srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584}() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  10. tx_templavoila_pi1->main_page() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  11. tx_templavoila_pi1->renderElement() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:196
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  12. tx_templavoila_pi1->processDataValues() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:331
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  13. tslib_cObj->cObjGet() /srv/www/html/typo3conf/ext/templavoila/pi1/class.tx_templavoila_pi1.php:605
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  14. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  15. tslib_content_Records->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  16. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_records.php:124
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  17. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:600
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  18. tslib_content_Case->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  19. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_case.php:52
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  20. tslib_content_ContentObjectArray->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  21. tslib_cObj->cObjGet() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_contentobjectarray.php:48
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  22. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:562
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  23. tslib_content_Case->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  24. tslib_cObj->cObjGetSingle() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_case.php:52
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  25. tslib_content_User->render() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:615
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  26. tslib_cObj->callUserFunction() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/content/class.tslib_content_user.php:55
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  27. call_user_func_array:{/srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584}() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  28. Tx_Extbase_Core_Bootstrap->run() /srv/www/typo3_src-4.7.11/typo3/sysext/cms/tslib/class.tslib_content.php:6584
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  29. Tx_Extbase_Core_Bootstrap->handleWebRequest() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Core/Bootstrap.php:212
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  30. Tx_Extbase_MVC_Web_FrontendRequestHandler->handleRequest() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Core/Bootstrap.php:242
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  31. Tx_Extbase_MVC_Dispatcher->dispatch() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Web/FrontendRequestHandler.php:85
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  32. Tx_Extbase_MVC_Controller_ActionController->processRequest() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Dispatcher.php:96
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  33. Tx_Extbase_MVC_Controller_ActionController->callActionMethod() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php:166
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  34. call_user_func_array:{/srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php:305}() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php:305
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  35. Tx_MyExtension_Controller_ProjectController->listAction() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/MVC/Controller/ActionController.php:305
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  36. Tx_Extbase_Persistence_Repository->findByUid() /srv/www/html/typo3conf/ext/my_extension/Classes/Controller/ProjectController.php:90
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  37. Tx_Extbase_Persistence_Query->equals() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Repository.php:339
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  38. Tx_Extbase_Persistence_Query->getSelectorName() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Query.php:454
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  39. Tx_Extbase_Persistence_Query->getSource() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Query.php:196
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  40. Tx_Extbase_Persistence_Mapper_DataMapper->convertClassNameToTableName() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Query.php:210
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  41. Tx_Extbase_Persistence_Mapper_DataMapper->getDataMap() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php:558
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  42. Tx_Extbase_Persistence_Mapper_DataMapFactory->buildDataMap() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php:545
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  43. Tx_Extbase_Reflection_Service->getClassSchema() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapFactory.php:136
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  44. Tx_Extbase_Reflection_Service->buildClassSchema() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/Service.php:236
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  45. Tx_Extbase_Reflection_Service->getClassPropertyNames() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/Service.php:424
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  46. Tx_Extbase_Reflection_Service->reflectClass() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/Service.php:220
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  47. Tx_Extbase_Reflection_Service->convertParameterReflectionToArray() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/Service.php:393
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  48. Tx_Extbase_Reflection_ParameterReflection->getClass() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/Service.php:456
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  49. ReflectionParameter->getClass() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/ParameterReflection.php:61
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  50. spl_autoload_call() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/ParameterReflection.php:61
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  51. t3lib_autoloader::autoload() /srv/www/typo3_src-4.7.11/typo3/sysext/extbase/Classes/Reflection/ParameterReflection.php:61
[Tue Apr 28 15:33:52 2015] [error] [client ] PHP  52. t3lib_div::requireFile() /srv/www/typo3_src-4.7.11/t3lib/class.t3lib_autoloader.php:97

查看调用堆栈时,我想知道 http://php.net/manual/de/function.spl-autoload-call.php 中描述的 spl_autoload_call 的 "inheritance problem" 是否与该问题有关。

另一个更新: 现在我自己的代码在调用堆栈中,我能够找到问题的根本原因。我现在可以注释掉对第二个存储库 ($this->sfbRepository->findByUid($id);) 的调用,并且插件正在运行。导入看起来像:

/**
 * sfbRepository 
 *
 * @var Tx_MyExtension_Domain_Repository_SFBRepository
 * @inject
 */
protected $sfbRepository = NULL;

存储库的声明是:

class Tx_MyExtension_Domain_Repository_SFBRepository extends \Tx_Extbase_Persistence_Repository {
}

最终更新: 最后一个只是(已更改)class 名称中的错字...

为了避免自动加载的麻烦,即使您不使用命名空间,也需要坚持 Extbase 命名约定:

Tx_MyExtension_Controller_ProjectController

应该是以下文件:

EXT:my_extension/Classes/Controller/ProjectController.php

(注意在目录结构中转换为下划线的大驼峰扩展名。)

如果您不知道TYPO34.x中的哪个6.2class和哪个class,您可以在“Legacy Classes for IDE”文件中搜索。请记住也要适应 @inject 注释,因为注入是基于注释的:

* @var Tx_MyExtension_Domain_Repository_ProjectRepository
* @inject