So I'm trying to return a find 'all' array using the id of a 'Product' as the index key for each Product.
Typically it returns:
array(
(int) 0 => array(
'Product' => array(
'id' => '1232',
'category_id' => '330',
'name' => 'Product #1',
)
),
(int) 1 => array(
'Product' => array(
'id' => '1245',
'category_id' => '310',
'name' => 'Product #2',
)
),
(int) 2 => array(
'Product' => array(
'id' => '1248',
'category_id' => '312',
'name' => 'Product #3',
)
)
)
Whereas ideally I'd like it to return:
array(
(int) 1232 => array(
'Product' => array(
'id' => '1232',
'category_id' => '330',
'name' => 'Product #1',
)
),
(int) 1245 => array(
'Product' => array(
'id' => '1245',
'category_id' => '310',
'name' => 'Product #2',
)
),
(int) 1248 => array(
'Product' => array(
'id' => '1248',
'category_id' => '312',
'name' => 'Product #3',
)
)
)
Is this possible? And how do I go about doing it?
I have an excel spreadsheet of records that I need to match ID's to, so currently I have it iterating each spreadsheet row and performing a 'first' find to get any results, then act upon them if they do.
It works, but the recordset has grown to over 28000 and so performing one find for each has noticeable overhead.
If I can do this simply in the 'find' operation it would be great, if not, any noticeable increase in performance would be appreciated.