I tyed get with the method $this>model->find() an array with ids of my model that have this form:
Array ( [0] => 2, [1] => 3) (value are the IDs)
and I try $this->model->find('list') I thought that would work too but for some strange reason I have done:
$this->model->find('list',array('recursive' => -1 ,'fields' => array('model.type_id'),'conditions'=>$cond));
and the query result is:
SELECT `model`.`round_id`, `model`.`type_id` FROM `database`.`model` AS `X` WHERE `X`.`Round_id` = '1'
If I make this query to the database returns two values but cakephp returns only one:
Array ( [1] => 2 )
i do not know that may be going
I would use
if you really need the 0 based integer keys, you can still do:
but that is not necessary IMO.
Update:
After your question update the whole meaning of your question itself changed:
If you specify only id, they keys and values will both be filled with it.
Using
'fields' => array('round_id', 'type_id')you have round_id filling the keys, and type_id filling the values for find(list).find(list) returns always a list (key + value row). If you don’t want that use find(all) then.