We are using Cake 2.2.2 and we have the following tables -
Article -> id, group_id, town_id, ...
Group -> id, town_id, ...
Town -> id, ...
The Article and Group tables need to modify their data with data from the
Town table, so in each of those Models we have an afterFind callback that
checks for the presence of Town data in the results and if found does the
updates.
This works fine for the primary model. However Group is also an associated
model to the Article table, so if I execute the following find function -
$this->Article->find('all', array('contain' => array('Town', 'Group',
'Group.Town')));
Cake does run the query and assembles the data correctly, but the Group
afterFind callback is called without the associated Town data, even though
it is part of the query. As far as I can tell, the Group->afterFind is
called before the queries for its associated tables are run.
I'm looking for an elegant way to do this within the model, rather than
resorting to putting the code in the controller.
Thanks in advance
Mark
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.