[TYPO3-mvc] settings within a repository?

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Aug 18 19:12:03 CEST 2010


Hey Sven,

>>> how can i get the settings (TSetup) within a repository?
>
>> You should not need settings in your repository. So - like Thomas - I'd
>> be interested in what you're trying to achieve.
> In this case, I tried to write a function like findAllTrainers() or findAllStudents() or something similar.
> The trainers or students are defined by being member of a specific feuser-group, which I can set in the TSetup.

That could be a edge case - but probably create a feuser service that's 
dealing with this.

> I'm really surprised, that you think the settings are not needed in the repository!
> What about configure something like sorting, filtering etc. in the TSetup? Should I really pass all this configurations as parameters in each function in each controller?

For the sorting, I'd probably say yes. For filtering options I use a 
"demand" object I pass to my repository methods. You can have a look at 
Jochens extension sjr_offers where he does the same. How you fill that 
demand object from within your controller is up to you. But if you don't 
see any other way, then at least only pass a subset of the settings 
array to the repository (so a array instead of a demand object) - in any 
case the repository should not depend on $this->settings but get the 
needed configuration/options passed as arguments. For repositories that 
are triggering webservices it might look a bit different - but for 
regular repositories it should be a good approach. But of course you're 
free to do what ever you like best - those are just suggestions - no 
strict rules.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list