Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is an Interactor allowed to depend on more than one repositories? #7

Open
mradzinski opened this issue Sep 26, 2017 · 1 comment
Open

Comments

@mradzinski
Copy link

mradzinski commented Sep 26, 2017

Hi, just stumbled with your articles on medium and had this quick question regarding the interactor pattern: is an Interactor supposed to have one and only one dependency on a repository or can actually depend on more than one?

For example: Lets suppose that we have a UserProfileInteractor wich has only one method called GetUser and a UserRepository which has N methods (doesn't matter which ones for the sake of the example). Now, that user needs to belong to a Company and that model "belongs" to its own repository called CompanyRepository which has other methods, but specifically one called getCompany that we'll need to invoke to assemble our user on the UserProfileInteractor. For completeness we also have a presenter called UserProfilePresenter which will have an instance of UserProfileInteractor and is in charge of "presenting" the user profile displaying the user information + that user's company data.

How would you handle such a thing? Would you make UserProfileInteractor have dependencies on both UserRepository and CompanyRepository? Would an interactor depending on two repositories violate the separation of concerns in any way?

Cheers and thanks for the articles, really enjoying them.

@wengelef
Copy link

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants