/** * @param Command|DoSomethingImportant $command */ public function handle(Command $command) { $task = new Task($command->getTask()); $task->execute(); $this->om->persist($task); }