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

Christian Kuhn lolli at schwarzbu.ch
Mon Jan 20 14:50:23 CET 2014


Hey,

On 12/05/2013 04:28 PM, Stig Nørgaard Færch wrote:
> I'm trying to use a repository in a service by declaring this:
>
> /**
>   * frontendUserRepository
>   *
>   * @var \TYPO3\Dkmbydel\Domain\Repository\FrontendUserRepository
>   */
> protected $frontendUserRepository;

I don't know your use case and what is going wrong in your case, but 
from an architectural point of view, you may aim to make services and 
utilities stateless (but not static), they should most likely not hold 
local data.
This reduces complexity and dependencies of your service classes.
 From this point of view, if eg. your controller fetches objects and 
feeds them to service methods as parameters, you probably don't need 
those repository injections.
This is just meant as a hint, you may have good reasons not to follow. 
Its just my personal experience that code improves if services are kept 
"stupid" if possible.

Regards
Christian


More information about the TYPO3-project-typo3v4mvc mailing list