I’m running into trouble while updating my TYPO3 extension from version 6.2 to 7.6.X. The main issue seems to be with the frontend user repository implementation.
Here’s my current code setup:
/**
* userRepo variable initialized as null
*
* @var \Typo3\CMS\Extbase\Domain\Repository\FrontendUserRepository
* @inject
*/
protected $userRepo = NULL;
When I try to run this code, I keep getting an error message. Has anyone else faced similar problems during the upgrade process? I’m not sure what changes were made to the repository handling between these versions. Any help would be really appreciated!
hey luke, you’re missin the namespace declaration at the top of your class file. add use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository;
then use FrontendUserRepository
in your annotation instead of the full path. should fix the injection issues after the upgrade.
TYPO3 7.6 completely changed how dependency injection works. You can’t use @inject
annotations anymore - you’ll need constructor injection or setter methods instead. For constructor injection, add your repository parameter to __construct()
and call parent::__construct()
. Or create a setter method like injectFrontendUserRepository(FrontendUserRepository $userRepository)
- Extbase picks these up automatically if you follow the naming convention. They ditched annotation-based injection for more explicit dependency management in this version.
Interesting issue! What’s the exact error message? Are you using custom methods in your frontend user repo or just standard extbase ones? Wondering if it’s related to namespace changes between versions 