It seems my afterFind methods are not working when the model is fetched
via an association.

I'm using 1.1.8.3544, but have found this in previous versions too...

Looking at dbo_source, it seems like the afterFind methods should be
triggered for all associations (around line 594), but that's not the
case for me.
According to this trac: https://trac.cakephp.org/ticket/648 someone
else found this problem in 1.1.6.3264, but it has been reported fixed
since 1.1.7.3372.

In the example below Category hasMany Award, and Award belongsTo
Category.  Both models have the afterFind method below.

function afterFind($results){
        foreach($results as $i => $result){
                if(isset($results[$i]['Category']['title']))
                        $results[$i]['Category']['title'] =
unserialize($results[$i]['Category']['title']);
        }
        return $results;
}
(don't ask why I'm serializing data, it's a quick & dirty solution for
a quick & dirty project :P )



The data is returned with the first level afterFind having run, but
nothing further.

    [0] => Array
        (
            [Category] => Array
                (
                    [id] => 4
                    [order] => 0
                    [name] => Category 1
                    [title] => English Title Oh Yes
                    [description] => English Description
                )

            [Award] => Array
                (
                    [0] => Array
                        (
                            [id] => 1
                            [category_id] => 4
                            [name] => Award 01
                            [title] => a
                            [description] => a:5:{s:2:"en";s:13:"Award
01
Desc";s:2:"de";s:0:"";s:2:"fr";s:0:"";s:2:"ne";s:0:"";s:2:"es";s:0:"";}
                        )

                )

        )

Any ideas?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to