Exemple #1
0
 /**
  * @param User     $user
  * @param FilePath $relativeFilePath
  * @param string   $content
  * @param string   $commitMessage
  *
  * @throws \Exception
  */
 public function savePage(User $user, FilePath $relativeFilePath, $content, $commitMessage)
 {
     if (empty($commitMessage)) {
         throw new \Exception('Commit message must not be empty');
     }
     $relativeLockPath = $this->getLockPath($relativeFilePath);
     $this->assertHasLock($user, $relativeLockPath);
     $this->gitRepository->putContent($relativeFilePath, $content);
     $this->gitRepository->addAndCommit($this->getAuthor($user), $commitMessage, $relativeFilePath);
     $parsedMarkdownDocument = $this->markdownService->parse($relativeFilePath, $content);
     $this->eventDispatcher->dispatch('ddr.gitki.wiki.markdown_document.saved', new MarkdownDocumentSavedEvent($relativeFilePath, $user->getEmail(), time(), $parsedMarkdownDocument, $commitMessage));
 }