Пример #1
0
 public function map(EntityContract $entity, array $data)
 {
     $entity->setPosts(function () use($data) {
         return $this->postRepository->postsTagged($data['term_id']);
     });
     $entity->setParent(function () use($data) {
         $parent = null;
         if ($data['parent']) {
             $parent = $this->tagRepository->tagOfId($data['parent']);
         }
         return $parent;
     });
 }
Пример #2
0
 public function map(EntityContract $entity, array $data)
 {
     $entity->init((object) $data);
     $id = $data['ID'];
     $entity->setPosts(function () use($id) {
         return $this->postRepository->postsByAuthor($id);
     });
     $entity->setPages(function () use($id) {
         return $this->pageRepository->pagesByAuthor($id);
     });
     $entity->setComments(function () use($id) {
         return $this->commentRepository->commentsByAuthor($id);
     });
 }
Пример #3
0
 public function map(EntityContract $entity, array $data)
 {
     $entity->setPosts(function () use($data) {
         return $this->postRepository->postsInCategory($data['term_id']);
     });
     $id = $data['parent'];
     $entity->setParentId($id);
     $entity->setParent(function () use($id) {
         $parent = null;
         if ($id) {
             $parent = $this->categoryRepository->categoryOfId($id);
         }
         return $parent;
     });
 }