Ejemplo n.º 1
0
 /**
  * @param User $User
  * @param int $title
  * @param int $content
  * @param array $tags
  * @return Post
  */
 public function createPost(User $User, $title, $content, array $tags = [])
 {
     $Post = new Post();
     $Post->set(Post::FIELD_USER_OWNER, $User);
     $Post->set(Post::FIELD_TITLE, $title);
     $Post->set(Post::FIELD_CONTENT, $content);
     $Post->set(Post::FIELD_TAGS, $tags);
     $Post->set(Post::FIELD_CREATE_AT, Time::getTime());
     $Post->save();
     $FeedProvider = $this->getFeedProvider();
     $FeedProvider->getFeed(FeedType::MAIN)->savePost($Post);
     $FeedProvider->getFeed(FeedType::USER)->savePost($Post);
     $FeedProvider->getFeed(FeedType::TAG)->savePost($Post);
     return $Post;
 }