dongyao1895
2018-05-09 13:31
浏览 48
已采纳

Symfony - 在视图中呈现所有用户的视图

I returned 10 users in a view via this fucnion..

public function getUsers()
{
    $u = $this->get('u')->getUsersBy();

    return $this->render('@Templates/admin/users.html.twig',
        array('u' => $u)
    );

}

but I need to separate it and to return ALL users via second function, but can't figure this part out.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsgd5756 2018-05-09 15:58
    已采纳

    Your question is not very clear, but typically when you want to return all data from your db, you're doing something like :

        $users = $this->getDoctrine()->getRepository('YOUR/USER/ENTITY')->findAll();
        return $users;
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题