Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $photo)
 {
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId((int) $photo['id'])->setCover($photo['photo']);
     $entity = new PhotoEntity();
     $entity->setImageBag($imageBag)->setId($photo['id'], PhotoEntity::FILTER_INT)->setName($photo['name'], PhotoEntity::FILTER_HTML)->setAlbumId($photo['album_id'], PhotoEntity::FILTER_INT)->setAlbumName($this->albumMapper->fetchNameById($photo['album_id']), PhotoEntity::FILTER_HTML)->setPhoto($photo['photo'], PhotoEntity::FILTER_HTML)->setDescription($photo['description'], PhotoEntity::FILTER_HTML)->setOrder($photo['order'], PhotoEntity::FILTER_INT)->setPublished($photo['published'], PhotoEntity::FILTER_BOOL)->setDate(date('d/m/y', $photo['date']));
     return $entity;
 }
Esempio n. 2
0
 /**
  * Deletes a whole album by its id including all its photos
  * 
  * @param string $id Album's id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Save the name into a variable, before an album is removed
     $name = Filter::escape($this->albumMapper->fetchNameById($id));
     // Do remove now
     $this->removeAlbumById($id);
     $this->removeChildAlbumsByParentId($id);
     $this->track('The album "%s" has been removed', $name);
     return true;
 }