[TYPO3-mvc] [TYPO3 6.1beta1] Using a repository in a service...

Stig Nørgaard Færch snf at dkm.dk
Thu Dec 5 21:52:33 CET 2013


Thanks for your answer.

I forgot to add @inject in my example, because that is what I tried in 
the beginning. Actually I just copied the declaration from a controller, 
where it was working with no problems.

So I removed @inject when I tried to instantiate the class manually.

So I guess my next try will be to use the object manager.

Best regards,
Stig

Den 05-12-2013 16:48, Xavier Perseguers skrev:
> Hi,
>
>> /**
>>   * frontendUserRepository
>>   *
>>   * @var \TYPO3\Dkmbydel\Domain\Repository\FrontendUserRepository
>
> add @inject on a new line, empty cache and try again, this should work
> automagically
>
>>   */
>> protected $frontendUserRepository;
>
> [...]
>
>> I then tried to instantiate the object manually by:
>> $user =
>> \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\Dkmbydel\Domain\Repository\FrontendUserRepository');
>
> You should use Extbase's object manager when you work with Extbase, not
> the standard TYPO3 way of instantiating class instances.
>
> Kind regards
>



More information about the TYPO3-project-typo3v4mvc mailing list