感謝以下幾篇文章:
- Symfony Admin Generator in multi user setup (restricting records in LIST view)
- The symfony 2009 Advent Calendar: Advanced Routing (part 2)
作法有點嘮叨,但是在暫時沒有足夠時間搞 admin generator theme 之前,還是先這樣吧:
# actions.class.php
protected function buildQuery()
{
$query = parent::buildQuery();
// do what ever you like with the query like
$query->andWhere('user_id = ?', $this->getUser()->getId());
return $query;
}
0 Comments:
Post a Comment