DEV Community

Discussion on: Where Do I Put My Business Rules And Validation?

Collapse
 
jamesmh profile image
James Hickey

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?

Collapse
 
rodrigojuarez profile image
Rodrigo Juarez

Usually, that's my approach; I have a validate method in the repo returning a tuple from there.