I writing system following hexagonal architecture.
I have asynchronous commands and synch query objects split in UseCase.
My src folder look like:
-src
--Entity
---Task.php
--UseCase
---Command
----CreateTask
-----CreateTaskUseCase.php
-----CreateTaskCommand.php
My Question is: What i can/should use to send data via Command in constructor of UseCase\Command\CreateTask\CreateTaskCommand
\Entity\Task UseCase\Command\CreateTask\Request\Task that would have all needed dataThis is trivial example to show problem.
Right now i'm using object from Domain (Entiti\Task etc)
In real situation, i have UseCase\Command\CreateProcess that need
By following DDD, Process is my aggregate. All entities exists only due construct Process(Node,Leaf,Resource,Person). Then i don't want separate way, to create the others entities, because that way works my business logic.
Due that problem, question is: what should i to choose? Breaking some rules?
Problems:
Request\* make me alot of classes, but clear way of use command, and much more work - unitTest etc.Thanks for help.
After some time, and experience - Best option is to use standard data from PHP. Eventually, it is good to create objects for that Command (second option), but this will consume time to create classes and tests.
Never use something from domain - this is huge drawback in future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With