public function insert(Project $project) { $this->transaction->requestTransaction(); try { $id = $project->insert($this->conn); $settings = new ProjectSettings($this->settingsStorage); $settings->setProject($project); $this->eventDispatcher->dispatch(CantigaEvents::PROJECT_CREATED, new ProjectCreatedEvent($project, $settings)); $settings->saveSettings(); return $id; } catch (\Exception $exception) { $this->transaction->requestRollback(); throw $exception; } }