예제 #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;
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $category)
 {
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId((int) $category['id'])->setCover($category['cover']);
     $entity = new CategoryEntity();
     $entity->setId($category['id'], CategoryEntity::FILTER_INT)->setImageBag($imageBag)->setLangId($category['lang_id'], CategoryEntity::FILTER_INT)->setParentId($category['parent_id'], CategoryEntity::FILTER_INT)->setWebPageId($category['web_page_id'], CategoryEntity::FILTER_INT)->setTitle($category['title'], CategoryEntity::FILTER_HTML)->setName($category['name'], CategoryEntity::FILTER_HTML)->setDescription($category['description'], CategoryEntity::FILTER_SAFE_TAGS)->setSeo($category['seo'], CategoryEntity::FILTER_BOOL)->setSlug($this->webPageManager->fetchSlugByWebPageId($category['web_page_id']))->setOrder($category['order'], CategoryEntity::FILTER_INT)->setKeywords($category['keywords'], CategoryEntity::FILTER_HTML)->setMetaDescription($category['meta_description'], CategoryEntity::FILTER_HTML)->setPermanentUrl('/module/blog/category/' . $entity->getId())->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setCover($category['cover']);
     return $entity;
 }