The book suggests to structure a project based on Bounded Contexts, where each has 3 main folders: Application, Domain, and Infrastructure. Models, services, value objects, all go to Domain folder. But sometimes in reality, we have to deal with shared Value Objects like Url. I use Url value object both in \Blog\Domain\Model\Article::getOriginalArticleUrl() and \Author\Domain\Model\Author::personalBlogUrl() and I can't figure out where this value object would belong to: is it in Blog or Author? Or I have to make a module named Shared?
I guess it would be so nice to go for an example in such situation 🙂
Hi @dewey92, you can put the Url VO in /Domain/Model/Url/Url.php, for example. Or even in /Domain/Model/Url.php if you want to. I do not recommend to create a "Shared" folder.
The book suggests to structure a project based on Bounded Contexts, where each has 3 main folders: Application, Domain, and Infrastructure. Models, services, value objects, all go to Domain folder. But sometimes in reality, we have to deal with shared Value Objects like
Url
. I useUrl
value object both in\Blog\Domain\Model\Article::getOriginalArticleUrl()
and\Author\Domain\Model\Author::personalBlogUrl()
and I can't figure out where this value object would belong to: is it inBlog
orAuthor
? Or I have to make a module namedShared
?I guess it would be so nice to go for an example in such situation 🙂