Example #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;
 }