If the data is coming from somewhere else, but is required to do a particular task, then usually I would have some repository or something that will fetch the data I need and then include that as part of the value object's dependencies.
Sometimes, if this means returning too much data, then having a repository with a method that returns a bool might be a better choice?
Nice article! Can you elaborate about how to do validation when the data is outside the entity (in your scenario, for example, customer settings)
If the data is coming from somewhere else, but is required to do a particular task, then usually I would have some repository or something that will fetch the data I need and then include that as part of the value object's dependencies.
Sometimes, if this means returning too much data, then having a repository with a method that returns a
bool
might be a better choice?Usually, that's my approach; I have a validate method in the repo returning a tuple from there.