As many have failed before me, I am trying to massage some data in the 
afterFind callback in CakePHP 2.3.6.

 public function afterFind($results, $primary = false) {
        $results = parent::afterFind($results, $primary);
        foreach ($results as $key => $val) {
              //... do stuff
        }
        return $results;
    }

But, as I have seen in many examples on the web, there are many different 
formats that can be expected in the $results array, depending on which 
model called the find method (associated data gets quite ugly).
I'm thinking of using THIS solution: 
https://groups.google.com/d/topic/cake-php/Mqufi67UoFo/discussion
Is this *really *the best method we have?

If yes, I sure hope this will change in CakePHP 3.0. IMHO, complex array 
format tests shouldn't exist in a model. Why not just pass me the results 
array before merging it into the caller-model results?

Are there any alternatives? In despair, I'm thinking of changing the Core 
DboSource and plugging in a new callback before MergeAssociation. Yes, it's 
that bad, please help! :)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to