DDD: service contains two repository
- by tikhop
Does it correct way to have two repository inside one service and will it be an application or domain service?
Suppose I have a Passenger object that should contains Passport (government id) object. I am getting Passenger from PassengerRepository. PassengerRepository create request to server and obtain data (json) than parse received data and store inside repository.
I have confused because I want to store Passport as Entity and put it to PassportRepository but all information about password contains inside json than i received above.
I guess that I should create a PassengerService that will be include PassengerRepository and PassportRepository with several methods like removePassport, addPassport, getAllPassenger and etc.
UPDATE:
So I guess that the better way is represent Passport as VO and store all passports inside Passenger aggregate. However there is another question: Where I should put the methods (methods calls server api) for management passenger's passport. I think the better place is so within Passenger aggregate.