Using Doctrine:
$result = array(
array('user_id'=>1, 'name'=>'foo'),
array('user_id'=>2, 'name'=>'bar'),
);
$expected = array(
1 => array('user_id'=>1, 'name'=>'foo'),
2 => array('user_id'=>2, 'name'=>'bar'),
);
Is it possible to somehow key/index the result array on some field via Doctrine\\ORM\\Query ?
Maybe you can use
INDEX BY t.userId
where t is your table/entity alias
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.