protected function createPageFile(DirectoryPath $repositoryPath, DirectoryPath $directoryPath, SplFileInfo $file) { $pageFile = new PageFile($repositoryPath->toAbsoluteFileString(), $directoryPath->toRelativeFileString(), $file->getRelativePathName()); $title = $this->elasticsearchRepository->getTitle($pageFile->getAbsolutePath()); if (empty($title)) { $title = $pageFile->getRelativePath()->getFileName(); } $pageFile->setTitle($title); return $pageFile; }
public function __construct($repositoryPath) { $pathString = $repositoryPath; if (!StringUtils::startsWith($pathString, '/')) { throw new \Exception('Repository Path must be absolute'); } if (!StringUtils::endsWith($pathString, '/')) { $pathString .= '/'; } $this->repositoryPath = DirectoryPath::parse($pathString); }
public function __construct($basePath, $currentDirectoryPath, $relativeDirectoryPath) { parent::__construct($basePath . $currentDirectoryPath . $relativeDirectoryPath); $this->absolutePath = DirectoryPath::parse($currentDirectoryPath . $relativeDirectoryPath); $this->relativePath = DirectoryPath::parse($relativeDirectoryPath); }
/** * @param Request $request * @param DirectoryPath $path * * @return Response */ public function addFolderAction(Request $request, DirectoryPath $path) { $this->assertRole('ROLE_COMMITTER'); $path = DirectoryPath::parse($path); $form = $this->createFormBuilder()->add('title', 'text', array('label' => 'Title', 'required' => true))->add('dirname', 'text', array('label' => 'Foldername', 'required' => true))->add('create', 'submit')->getForm(); $form->handleRequest($request); if ($form->isSubmitted()) { if ($form->isValid()) { $title = $form->get('title')->getData(); $dirname = $form->get('dirname')->getData(); $subDirPath = $path->appendDirectory($dirname); $this->getWikiService()->createFolder($subDirPath); return $this->redirect($this->generateUrl('ddr_gitki_wiki_directory', array('path' => $subDirPath->toAbsoluteUrlString()))); } } return $this->render('DdrGitkiBaseBundle:Wiki:directory.addFolder.html.twig', array('form' => $form->createView(), 'path' => $path)); }
/** * @param DirectoryPath $repositoryPath * @param DirectoryPath $directoryPath * @param SplFileInfo $file * * @return PageFile */ protected function createPageFile(DirectoryPath $repositoryPath, DirectoryPath $directoryPath, SplFileInfo $file) { $pageFile = new PageFile($repositoryPath->toAbsoluteFileString(), $directoryPath->toRelativeFileString(), $file->getRelativePathName()); $pageFile->setTitle($pageFile->getRelativePath()->getFileName()); return $pageFile; }