Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

typo3

extbase

I have created an extension for Typo3 4.7 (actually, it was created for Typo3 6.2, but I am trying to backport it) using the extbase framework. I have already removed all namespaces from the core and also checked TYPO3 - Call another repository. However, I have the problem that calling the frontend plugin causes a PHP error PHP Fatal error: Cannot redeclare class [...]\\ProjectController in [...]/ProjectController.php on line 127 (line 127 is the closing brace of the class). Within my plugin, I do not have any require/include except for the "dynamicConfigFile"s.

The controller in question uses dependency injection like this:

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

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

and I am running PHP 5.5.14. The whole code works on Typo3 6 if I change the "Tx_..." stuff to use namespaces instead.

So far, I found only one website about this issue (https://forum.typo3.org/index.php/t/203725/), which says that using dependency injection instead of t3lib_div::makeInstance has fixed it. However, I am already using dependency injection.

Furthermore, if I add print_r(get_declared_classes()); before the declaration of the class, it does not print the class in question, i.e. it seems not to be declared.

Has anyone encountered such a problem before? What else could I do to troubleshoot this?

Edit: The whole stack trace is

[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

Edit: In the meantime, I have tried using namespaces and removing them - the result is the same in either case. Furthermore, removing the dependency injection has no effect either. If I add a !class_exists() check around the declaration, the script does not crash, but an exception is raised and Typo3 complains about the class being not defined in the log. It is almost as if the class were somehow there, but cannot be used or is somehow different ...

Edit: I have now renamed (hopefully) all classes and comments to match the extbase naming scheme. However, the error moved and the call stack is now like:

[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

When looking at the callstack, I wonder wheher the "inheritance problem" of spl_autoload_call described at http://php.net/manual/de/function.spl-autoload-call.php could be related to the issue.

Another update: Now that my own code is in the call stack, I was able to find the root cause of the issue. I can now comment out a call to a second repository ($this->sfbRepository->findByUid($id);) and the plugin is working. The import looks like:

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

The declaration of the repository is:

class Tx_MyExtension_Domain_Repository_SFBRepository extends \Tx_Extbase_Persistence_Repository {
}

Final Update: The last one just was a typo in the (changed) class name ...

like image 311
Christoph Avatar asked Nov 09 '22 14:11

Christoph


1 Answers

In order to have no hassle with autoloading, you need to stick to the Extbase naming convention even if you're not using namespaces:

Tx_MyExtension_Controller_ProjectController

should be the following file:

EXT:my_extension/Classes/Controller/ProjectController.php

(Mind the UpperCamelCase extension name which transform to underscores in the directory structure.)

If you don't know which 6.2 class was which class in TYPO3 4.x, you can search for them in the "Legacy Classes for IDE" file. Keep in mind to also adapt @inject annotations because the injection is based on the annotation:

* @var Tx_MyExtension_Domain_Repository_ProjectRepository
* @inject
like image 115
lorenz Avatar answered Nov 15 '22 06:11

lorenz