I am currently checking out the DDD pattern and (tried) to refactor a project of mine accordingly.
Now I got a case where I don't really know what to do: Some business logic can be called by multiple entities. In my case it's possible to mark items as hidden.
The item can be a Product or a Category (or many more).
The related event is called MarkedItemAsHidden, fired by an action handler called MarkItemAsHidden, which accepts the item as first parameter and fires the event based on the item's class.
So I got:
- Events:
MarkedItemAsHidden
- Actions:
MarkItemAsHidden($item)
- Projector:
HidingProjector
But where do I put those classes?
My app has a Domain-directory, which includes:
-
Product
-
Category
-
Cart
- ...
but I can't really decide where to put these "shared classes".