I found the problem, but cannot fix it. Its my afterFind() method for
my Article model.
/**
* Executed after a find() call
*/
function afterFind($results) {
if (!empty($results)) {
foreach ($results as &$result) {
if (is_array($result) &&
!empty($result['Article']['id'])) {
$result['Article']['favorites'] =
$this->Favorites->find('count',
array(
'conditions' =>
array('Favorites.article_id' => $result
['Article']['id']),
'contain' => false,
'recursive' => -1
));
$result['Article']['comments'] =
$this->Comments->find('count',
array(
'conditions' =>
array('Comments.item_id' => $result['Article']
['id'], 'Comments.status' => 'approved'),
'contain' => false,
'recursive' => -1
));
}
}
}
return $results;
}
Even when I disable contain and recursive, it still grabs all the
extra data. BUT WHEN I remove the after find, the correct data is
returned.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---