コード例 #1
0
 /**
  * Throws exception if page duplicate is found
  * @param PageLocalization $pageData
  * @param Path $newPath
  */
 protected function checkForDuplicates(PageLocalization $pageData, Path $newPath)
 {
     $page = $pageData->getMaster();
     $locale = $pageData->getLocale();
     $repo = $this->em->getRepository(PageLocalizationPath::CN());
     $newPathString = $newPath->getFullPath();
     // Duplicate path validation
     $criteria = array('locale' => $locale, 'path' => $newPath);
     $duplicate = $repo->findOneBy($criteria);
     /* @var $duplicate PageLocalizationPath */
     if (!is_null($duplicate) && !$pageData->getPathEntity()->equals($duplicate)) {
         throw new DuplicatePagePathException(sprintf('Page with path [%s] already exists.', $newPathString), $pageData);
     }
 }
コード例 #2
0
 public function pathToString(VisitorInterface $visitor, Path $path)
 {
     return $path->getFullPath(Path::FORMAT_LEFT_DELIMITER);
 }