Arn*_*e L 1 typo3 extbase typo3-7.6.x
我正在使用auth类型的服务来添加基于API的登录.我尝试通过Extbase添加一个带有FrontendUserRepository的用户@inject.但这不起作用.
我做错了什么,或者是否要尽早使用依赖注入?
PS:我知道我可以通过以下方式使用存储库:
$objectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$this->frontendUserRepository = $objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository');
Run Code Online (Sandbox Code Playgroud)
带@Inject注释的DI 仅适用于TYPO3\CMS\Extbase\Object\ObjectManager实例加载的对象.auth服务正在实例化,使用GeneralUtility::makeInstanceService()它反过来使用GeneralUtility::makeInstance()(请参阅TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::checkAuthentication()),因此@Inject注释无效.您必须自己使用已提到的解决方法.
| 归档时间: |
|
| 查看次数: |
1143 次 |
| 最近记录: |