I'm sure this is a newbie question but I've been unable find the answer. If I run findAll on a simple table with no joins, I get an array with an unnecessary middle level with the model name, eg.
Array ( [0] => Array ( [User] => Array ( [id] => 1 [username] => user1 [emailaddress] => [EMAIL PROTECTED] ) ) ) [1] => Array ( [User] => Array ( [id] => 2 [username] => user2 [emailaddress] => [EMAIL PROTECTED] ) ) [2] => Array ( [User] => Array ( [id] => 3 [username] => user3 [emailaddress] => [EMAIL PROTECTED] ) ) ) ) I would prefer: Array ( [0] => Array ( [id] => 1 [username] => user1 [emailaddress] => [EMAIL PROTECTED] ) [1] => Array ( [id] => 2 [username] => user2 [emailaddress] => [EMAIL PROTECTED] ) [2] => Array ( [id] => 3 [username] => user3 [emailaddress] => [EMAIL PROTECTED] ) ) I realise that CakePHP probably needs that middle level with the model name, ie. [User], to create views and so forth but it seems to be a bit redundant for non-Cake-specific operations. What I mean is that if I have executed $this->User->findAll(); I don't need a row in the array telling me that the results pertain to User. >From my experience, the second type of array without the middle level is a common way to organise data retrieved from a database, eg. for passing to a DataGridColumn in Flex/Flash using AMFPHP, so I was wondering if there is a way to do this with findAll or if there is another Cake function available to achieve this. I know I could use query() to do the same thing but as I would imagine it's such a common thing to do I thought there might be a Cake way of doing it. At the moment I'm doing this: function getUsers() { $temp = $this->User->findAll(); // Assoc array returned from Cake's findAll is too deep so remove the middle layer foreach ($temp as $value) { list($key, $val) = each($value); $userArray[] = $val; } return $userArray; } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---