Ejemplo n.º 1
0
 protected function getYAGObjectInfoByPathInfo(PathInfo $pathInfo)
 {
     switch ($pathInfo->getPathType()) {
         case PathInfo::INFO_PID:
             return array('name' => $pathInfo->getDisplayName() . '|' . $pathInfo->getPid(), 'identifier' => $pathInfo->getIdentifier(), 'storage' => $this->storage->getUid());
             break;
         case PathInfo::INFO_GALLERY:
             $gallery = $this->galleryRepository->findByUid($pathInfo->getGalleryUId());
             if ($gallery instanceof \Tx_Yag_Domain_Model_Gallery) {
                 return $this->buildGalleryObjectInfo($pathInfo, $gallery);
             }
             break;
         case PathInfo::INFO_ALBUM:
             $album = $this->albumRepository->findByUid($pathInfo->getAlbumUid());
             if ($album instanceof \Tx_Yag_Domain_Model_Album) {
                 return $this->buildAlbumObjectInfo($pathInfo, $album);
             }
             break;
         case PathInfo::INFO_ITEM:
             $item = $this->itemRepository->findByUid($pathInfo->getItemUid());
             if ($item instanceof \Tx_Yag_Domain_Model_Item) {
                 return $this->buildItemObjectInfo($pathInfo, $item);
             }
             break;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @dataProvider pathDataProvider
  *
  * @param $type
  * @param $pid
  * @param $galleryUid
  * @param $albumUid
  * @param $itemUid
  * @param $expectedPath
  */
 public function pathInfoTest($type, $pid, $galleryUid, $albumUid, $itemUid, $expectedPath)
 {
     $this->pathInfo->setPathType($type)->setPid($pid)->setGalleryUId($galleryUid)->setAlbumUid($albumUid)->setItemUid($itemUid);
     $this->assertEquals($expectedPath, $this->pathInfo->getYagDirectoryPath());
 }