예제 #1
0
 /**
  * Removes an album by its associated id
  * 
  * @param string $albumId
  * @return boolean
  */
 private function removeAlbumById($albumId)
 {
     $this->albumMapper->deleteById($albumId);
     $this->removeWebPage($albumId);
     // Grab all photos associated with target album id
     $photosIds = $this->photoMapper->fetchPhotoIdsByAlbumId($albumId);
     // Do batch removal if album has at least one photo
     if (!empty($photosIds)) {
         foreach ($photosIds as $photoId) {
             // Remove a photo
             $this->imageManager->delete($photoId) && $this->photoMapper->deleteById($photoId);
         }
     }
     $this->albumPhoto->delete($albumId);
     return true;
 }
예제 #2
0
 /**
  * Fetches all photos
  * 
  * @param boolean $published Whether to filter by published attribute
  * @param string $albumId Optional album id filter
  * @return array
  */
 public function fetchAll($published, $albumId = null)
 {
     return $this->prepareResults($this->photoMapper->fetchAll($published, $albumId));
 }
예제 #3
0
 /**
  * Gets photos count by their album id
  * 
  * @param string $albumId
  * @return integer
  */
 public function getCountByAlbumId($albumId)
 {
     return $this->photoMapper->countAllByAlbumId($albumId);
 }