the command; • Can use service objects; • Should affect only one entity/aggregate; • Can fire events; • Command handlers and commands have a relationship 1:1; • Can throw exceptions; • Should not return anything;
• Should report data back to the client using DTO tailored to the specific needs of the view; • It only queries data and can do calculations with the support of domain objects.
a set of changes; • Events are immutable and serializable; • We describe events using Ubiquitous Language and in the past tense; • We can use events to express history; • Events can't be undone; • If something went wrong, we compensate it with other event.
$student = $this->students->find($command->student()); // registering events $student->disenroll($command->enrollment()); // appends new events to the event store $this->students->save($student);
$student = $this->students->find($command->student()); // registering events $student->disenroll($command->enrollment()); // appends new events to the event store $this->students->save($student);