Looking at the source, the "problem" lies in cake/libs/model/ datasource/dbo_source.php, around line 875. Model and association data arrays are only merged if they are equal. Otherwise the behavior i've described is used explicitly so i'm guessing this is a feature (IMHO not a very good one...).
Core guys, can you enlighten me? Best regards. PS: I'm using Cake SVN 1.1.x branch on PHP5. On May 7, 11:53 am, Gonçalo Marrafa <[EMAIL PROTECTED]> wrote: > Hi bakers. > > I've come up with a problem(?) when changing data in afterFind() with > hasOne associations. > > Lets say i have a model SomeModel that hasOne SomeOtherModel. If i do a > find() (findAll(), etc.) on SomeModel i get: > > Array > ( > [SomeModel] => Array > ( > [field1] => value1 > [field2] => value2 > ) > [SomeOtherModel] => Array > ( > [field3] => value3 > [field4] => value4 > ) > ) > > All fine so far. Now let's say i have an afterFind() in SomeOtherModel > that changes the value of field3. What i get then is: > > Array > ( > [SomeModel] => Array > ( > [field1] => value1 > [field2] => value2 > ) > [SomeOtherModel] => Array > ( > [field3] => changed value3 > [field4] => value4 > [SomeOtherModel] => Array > ( > [field3] => value3 > [field4] => value4 > ) > ) > ) > > Is this normal behavior or a bug? > > Thanks in advance. > > -- > Gonçalo Marrafa <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
