May 28, 2017
0
Level 2
multiple models on repositories
I've learned how to use simple repositories where you pretty much make a repository for each model with simple function like create, find, delete etc. Life is good. But now I'm working on something where a single user action requieres 2 models and has to upload a file.. I decided to create repositories for what I'm trying to do and not for each model. Below is the outcome.
Controller:
$this->quotation->addQuotation()
QuotationRepository: Simplefied*
Quotation //model
File //model
$this->file->Create
$this->file->Upload
$this->quotation->create
Now my question is simple, is this good use of the repository pattern?
It feels like a stupid question but I just can't move on!
Alternative would be to import 2 repositories into the controller and write lots of logic there, which seems wrong to me.
Please or to participate in this conversation.