public function handleStartTaskListCommand(Commands\StartTaskListCommand $command) { $taskList = TaskList::start(TaskListId::generate()); foreach ($command->tasks as $task) { $taskList->add(TaskId::generate(), $task); } $this->taskListRepository->save($taskList); }
public function all() { $taskListIds = $this->eventStore->uniqueAggregates(); $taskLists = []; foreach ($taskListIds as $taskListId) { $taskListId = TaskListId::fromString($taskListId); $taskLists[] = $this->findById($taskListId); } return $taskLists; }