/**
  * @param PosterInterface           $poster
  * @param AtomInterface             $about
  * @param                           $content
  * @param array                     $params
  *
  * @return \Platform\Comment\Model\Comment
  */
 public function add(PosterInterface $poster, AtomInterface $about, $content, $params = [])
 {
     $parent = $about->getParent();
     $params = array_merge(['about_id' => $about->getId(), 'poster_id' => $poster->getId(), 'user_id' => $poster->getUserId(), 'about_type' => $about->getType(), 'poster_type' => $poster->getType(), 'parent_id' => $parent->getId(), 'parent_user_id' => $parent->getUserId(), 'parent_type' => $parent->getType(), 'content' => strip_tags(html_entity_decode($content)), 'created_at' => KENDO_DATE_TIME, 'modified_at' => KENDO_DATE_TIME], $params);
     $comment = new Comment($params);
     $comment->save();
     return $comment;
 }
Esempio n. 2
0
 /**
  * @param AtomInterface $object
  *
  * @return \Platform\Photo\Model\PhotoCover
  */
 private function findCoverByObject(AtomInterface $object)
 {
     return app()->table('platform_photo_cover')->select()->where('object_id=?', $object->getId())->where('object_type=?', $object->getType())->one();
 }