thx! missed that thread.
On 9 Gen, 17:10, grigri <j...@hendersonwebdesign.com> wrote: > The format of the `$results` array in `afterFind` varies, a lot, > depending on circumstance. > > Your best bet is to do a debug($results) inside `afterFind` to see > exactly what structure the data is in and act accordingly. There was > another thread on this recently. Your `afterFind` code must cope with > the different array structures. > > Other thread is > here:http://groups.google.com/group/cake-php/browse_thread/thread/32ab9f8b... > > hth > grigri > > On Jan 9, 3:21 pm, Ernesto <e.fanz...@gmail.com> wrote: > > > > > Hello. > > > i have 2 models, linked together by a HABTM relationship. > > The 2nd model has a function that formats some fields after the data > > is loaded. > > Why is this function not working if i load data from the HABTM > > relationship? > > is there any better way to make this work? > > > Here's an example > > > NOTE: this code is for example purpose only. Don't look @ typos :) > > > class Car extends AppModel { > > var $name = "Car"; > > > var $hasAndBelongsToMany = array( > > "Passenger" => array( > > "className" => "Passenger" > > ) > > ); > > > } > > > class Passenger extends AppModel { > > var $name = "Passenger"; > > > function afterFind($results, $primary = false) { > > $results["Passenger"]["Name"] = > > strtoupper($results["Passenger"] > > ["Name"]); > > return $results; > > } > > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---