Kohana 3 (ORM or DB) returning single field
What is the best way to retrieve results from one field using DB or ORM?
For example, I need an array of user's friends ids to pass them to other function. I'm currently doing it like this开发者_StackOverflow社区:
$friends_ids = $this->friends->find_all()->as_array('id', 'name');
$friends = array();
foreach ($friends_ids as $k => $v)
{
array_push($friends, $k);
}
Maybe there's a better way?
$friends = $this->friends->find_all()->as_array(NULL, 'id');
精彩评论