Suppose that I have the class Task, and this class has a TaskState.
TaskState has an id, name and description.
Both classes are Doctrine entities and are mapped to the Task and TaskState tables respectively.
My problem is the following, Task has a method called lock, this method needs to change the state of the Task entity, assigning a existent TaskState object that represent the "locked" state.
To have semantic meaning, this need to have no parameters, but, I need to access to the TaskState repository the get the suitable object to accomplish this logic.
So, how can I solve this problem? Have I design issues?
Thanks in advance!