在Typo3 4.7

时间:2015-04-27 14:55:57

标签: php typo3 extbase

我使用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行是该类的结束括号)。在我的插件中,除了“dynamicConfigFile”之外,我没有任何require / include

有问题的控制器使用依赖注入,如下所示:

/**
 * 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已修复它。但是,我已经在使用依赖注入。

此外,如果我在类的声明之前添加print_r(get_declared_classes());,它不会打印有问题的类,即它似乎没有被声明。

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

编辑:整个堆栈跟踪

[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会抱怨未在日志中定义类。几乎就像那个班级在那里,但是不能使用或者在某种程度上不同......

编辑:我现在已经重命名(希望)所有类和注释以匹配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

在查看callstack时,我想知道http://php.net/manual/de/function.spl-autoload-call.php中描述的spl_autoload_call的“继承问题”是否与此问题有关。

另一个更新:既然我自己的代码在调用堆栈中,我就能找到问题的根本原因。我现在可以注释掉对第二个存储库($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 {
}

最终更新:最后一个只是(更改过的)类名中的拼写错误...

1 个答案:

答案 0 :(得分:1)

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

Tx_MyExtension_Controller_ProjectController

应该是以下文件:

EXT:my_extension/Classes/Controller/ProjectController.php

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

如果您不知道哪个6.2班级是TYPO3 4.x中的哪个班级,您可以在" Legacy Classes for IDE"" Demo"文件。请记住,还要调整@inject注释,因为注入基于注释:

* @var Tx_MyExtension_Domain_Repository_ProjectRepository
* @inject