/** * Show user all posts * * @param $id * @return \Framework\Response\ResponseRedirect * @throws HttpNotFoundException */ public function showUserPostsAction($id) { if ($posts = Post::findByUsers_id((int) $id, 50)) { $user = User::findById((int) $id); $name = $user->name ? $user->name : 'NoNaMe person'; foreach ($posts as $post) { $post->name = $name; } return $this->render('index.html', array('posts' => $posts)); } else { throw new HttpNotFoundException('Page Not Found!'); } }