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
- create
UseCase\Command\CreateTask\Request\Task
that would have all needed data - only string/int/float
This 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
- Uuid
- Instance[id, name]
- Source[node_id, node_name, leaf_id, leaf_name]
- Resource[id,name,type etc. normal types Person[name,lastname]]
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:
- bind command with Object from inside Domain, will bind higher layer more to core. Any change in core, will chain react with all layers
- Creating
Request\*
make me alot of classes, but clear way of use command, and much more work - unitTest etc. - Using only standard type(int,string etc.) will make __counstruct with 20 arguments. I don't want multilevel array, as will no be clear of use this command.
Thanks for help.