Esempio n. 1
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;
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $post)
 {
     // Configure image bag
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId((int) $post['id'])->setCover($post['cover']);
     // Configure time bag now
     $timeBag = clone $this->timeBag;
     $timeBag->setTimestamp((int) $post['timestamp']);
     // And finally prepare post's entity
     $entity = new PostEntity();
     $entity->setImageBag($imageBag)->setTimeBag($timeBag)->setId($post['id'], PostEntity::FILTER_INT)->setLangId($post['lang_id'], PostEntity::FILTER_INT)->setWebPageId($post['web_page_id'], PostEntity::FILTER_INT)->setCategoryId($post['category_id'], PostEntity::FILTER_INT)->setPublished($post['published'], PostEntity::FILTER_BOOL)->setSeo($post['seo'], PostEntity::FILTER_BOOL)->setName($post['name'], PostEntity::FILTER_HTML)->setTitle($post['title'], PostEntity::FILTER_HTML)->setCategoryName($this->categoryMapper->fetchNameById($post['category_id']), PostEntity::FILTER_HTML)->setIntro($post['intro'], PostEntity::FILTER_SAFE_TAGS)->setFull($post['full'], PostEntity::FILTER_SAFE_TAGS)->setSlug(Filter::escape($this->webPageManager->fetchSlugByWebPageId($post['web_page_id'])))->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setPermanentUrl('/module/news/post/' . $entity->getId())->setTimestamp($post['timestamp'], PostEntity::FILTER_INT)->setKeywords($post['keywords'], PostEntity::FILTER_HTML)->setMetaDescription($post['meta_description'], PostEntity::FILTER_HTML)->setCover($post['cover'], PostEntity::FILTER_HTML)->setViewCount($post['views'], PostEntity::FILTER_INT);
     return $entity;
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $product)
 {
     // If the $id isn't set, then the product isn't valid
     if (!isset($product['id'])) {
         return new ProductEntity();
     }
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId($product['id'])->setCover($product['cover']);
     $entity = new ProductEntity();
     $entity->setImageBag($imageBag)->setId($product['id'], ProductEntity::FILTER_INT)->setLangId($product['lang_id'], ProductEntity::FILTER_INT)->setWebPageId($product['web_page_id'], ProductEntity::FILTER_INT)->setPrice($product['regular_price'], ProductEntity::FILTER_FLOAT)->setStokePrice($product['stoke_price'], ProductEntity::FILTER_FLOAT)->setInStock($product['in_stock'], ProductEntity::FILTER_INT)->setSpecialOffer($product['special_offer'], ProductEntity::FILTER_BOOL)->setDescription($product['description'], ProductEntity::FILTER_SAFE_TAGS)->setPublished($product['published'], ProductEntity::FILTER_BOOL)->setOrder($product['order'], ProductEntity::FILTER_INT)->setSeo($product['seo'], ProductEntity::FILTER_BOOL)->setSlug($this->webPageManager->fetchSlugByWebPageId($product['web_page_id']))->setTitle($product['title'], ProductEntity::FILTER_HTML)->setName($product['name'], ProductEntity::FILTER_HTML)->setKeywords($product['keywords'], ProductEntity::FILTER_HTML)->setMetaDescription($product['meta_description'], ProductEntity::FILTER_HTML)->setCover($product['cover'], ProductEntity::FILTER_TAGS)->setDate($product['date'])->setPermanentUrl('/module/shop/product/' . $entity->getId())->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setViewCount($product['views'], ProductEntity::FILTER_INT);
     // It's only set in valid entities
     if (isset($product['categories'])) {
         // Categories
         $entity->setCategoryIds($this->createCategoryIds($product['categories']))->setCategories($this->createCategoryPair($product['categories']));
     }
     return $entity;
 }
Esempio n. 4
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $category)
 {
     $entity = new VirtualEntity();
     $entity->setId($category['id'], VirtualEntity::FILTER_INT)->setWebPageId($category['web_page_id'], VirtualEntity::FILTER_INT)->setLangId($category['lang_id'], VirtualEntity::FILTER_INT)->setName($category['name'], VirtualEntity::FILTER_HTML)->setTitle($category['title'], VirtualEntity::FILTER_HTML)->setDescription($category['description'], VirtualEntity::FILTER_SAFE_TAGS)->setSlug($this->webPageManager->fetchSlugByWebPageId($category['web_page_id']), VirtualEntity::FILTER_HTML)->setSeo($category['seo'], VirtualEntity::FILTER_BOOL)->setKeywords($category['keywords'], VirtualEntity::FILTER_HTML)->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setMetaDescription($category['meta_description'], VirtualEntity::FILTER_HTML);
     return $entity;
 }
Esempio n. 5
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $form)
 {
     $entity = new VirtualEntity();
     $entity->setId($form['id'], VirtualEntity::FILTER_INT)->setLangId($form['lang_id'], VirtualEntity::FILTER_INT)->setWebPageId($form['web_page_id'], VirtualEntity::FILTER_INT)->setTitle($form['title'], VirtualEntity::FILTER_HTML)->setName($form['name'], VirtualEntity::FILTER_HTML)->setDescription($form['description'], VirtualEntity::FILTER_SAFE_TAGS)->setSeo($form['seo'], VirtualEntity::FILTER_BOOL)->setSlug(Filter::escape($this->webPageManager->fetchSlugByWebPageId($form['web_page_id'])))->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setPermanentUrl('/module/mail-form/' . $entity->getId())->setTemplate($form['template'], VirtualEntity::FILTER_HTML)->setKeywords($form['keywords'], VirtualEntity::FILTER_HTML)->setMetaDescription($form['meta_description'] . VirtualEntity::FILTER_HTML)->setMessage($form['message']);
     return $entity;
 }
Esempio n. 6
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $post)
 {
     $entity = new PostEntity();
     $entity->setId($post['id'], PostEntity::FILTER_INT)->setLangId($post['lang_id'], PostEntity::FILTER_INT)->setWebPageId($post['web_page_id'], PostEntity::FILTER_INT)->setCategoryTitle($this->categoryMapper->fetchNameById($post['category_id']), PostEntity::FILTER_HTML)->setTitle($post['title'], PostEntity::FILTER_HTML)->setName($post['name'], PostEntity::FILTER_HTML)->setCategoryId($post['category_id'], PostEntity::FILTER_INT)->setIntroduction($post['introduction'], PostEntity::FILTER_SAFE_TAGS)->setFull($post['full'], PostEntity::FILTER_SAFE_TAGS)->setTimestamp($post['timestamp'], PostEntity::FILTER_INT)->setPublished($post['published'], PostEntity::FILTER_BOOL)->setComments($post['comments'], PostEntity::FILTER_BOOL)->setSeo($post['seo'], PostEntity::FILTER_BOOL)->setSlug($this->webPageManager->fetchSlugByWebPageId($post['web_page_id']))->setKeywords($post['keywords'], PostEntity::FILTER_HTML)->setMetaDescription($post['meta_description'], PostEntity::FILTER_HTML)->setDate(date($this->getTimeFormat(), $entity->getTimestamp()))->setPermanentUrl('/module/blog/post/' . $entity->getId())->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setViewsCount($post['views'], PostEntity::FILTER_INT);
     return $entity;
 }
Esempio n. 7
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $announce)
 {
     $entity = new VirtualEntity();
     $entity->setId($announce['id'], VirtualEntity::FILTER_INT)->setCategoryId($announce['category_id'], VirtualEntity::FILTER_INT)->setLangId($announce['lang_id'], VirtualEntity::FILTER_INT)->setWebPageId($announce['web_page_id'], VirtualEntity::FILTER_INT)->setCategoryName($this->categoryMapper->fetchNameById($announce['category_id']), VirtualEntity::FILTER_HTML)->setTitle($announce['title'], VirtualEntity::FILTER_HTML)->setName($announce['name'], VirtualEntity::FILTER_HTML)->setIntro($announce['intro'], VirtualEntity::FILTER_SAFE_TAGS)->setFull($announce['full'], VirtualEntity::FILTER_SAFE_TAGS)->setOrder($announce['order'], VirtualEntity::FILTER_INT)->setIcon($announce['icon'], VirtualEntity::FILTER_HTML)->setPublished($announce['published'], VirtualEntity::FILTER_BOOL)->setSeo($announce['seo'], VirtualEntity::FILTER_BOOL)->setSlug($this->webPageManager->fetchSlugByWebPageId($announce['web_page_id']), VirtualEntity::FILTER_HTML)->setKeywords($announce['keywords'], VirtualEntity::FILTER_HTML)->setMetaDescription($announce['meta_description'], VirtualEntity::FILTER_HTML)->setPermanentUrl('/module/announcement/' . $entity->getId())->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()));
     return $entity;
 }
Esempio n. 8
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $category)
 {
     $entity = new VirtualEntity();
     $entity->setId($category['id'])->setLangId($category['lang_id'])->setCount($this->postManager->countAllPublishedByCategoryId($entity->getId()))->setSlug($this->webPageManager->fetchSlugByWebPageId($category['web_page_id']))->setTitle($category['name'] . sprintf(' (%s) ', $entity->getCount()))->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()));
     return $entity;
 }