Interesting question: why do you need to know? The User key contains user data, the Address key contains address data, and the two are related...no? I think your example array is missing some elements as there would normally be a user_id key in the Address section...I think.
Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 18 Nov 2010, at 15:45, psybear83 wrote: > Hi everybody > > I have a User model which when loaded results in something like the > following array: > > Array > ( > [User] => Array > ( > [id] => 3 > [name] => posts_editor > [password] => 9fb00060ce49a5d5fab91b350b1529fda941a1de > [superuser] => 0 > ) > [Post] => Array > ( > [0] => Array > ( > [id] => 3 > [user_id] => 3 > [title] => Comment from comments editor > [body] => I like editing comments :-) > ) > ) > [Group] => Array > ( > [0] => Array > ( > [id] => 1 > [name] => Posts Editors > [GroupsUser] => Array > ( > [id] => 1 > [group_id] => 1 > [user_id] => 3 > ) > ) > ) > ) > > > This is nice, but it seems that this array structure doesn't tell > itself where it came from, right? I could guess that it's from the > User model because there is only one key in the array that isn't > another array of data itself, but what if my model looked the > following (if my User model belonged to one Address): > > Array > ( > [User] => Array > ( > [id] => 3 > [name] => posts_editor > [password] => 9fb00060ce49a5d5fab91b350b1529fda941a1de > [superuser] => 0 > ) > [Address] => Array > ( > [street] => Some nice street 123 > [city] => Ducktown > ) > ) > > Then it could be a User or an Address model, right? Or can we tell > from the order that it's a User and not an Address (i.e. maybe always > the first key ist the model, could that be?)? Or is there any other > way to determine the source of a model data array? > > Thanks for help, guys > Josh > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected] > 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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
