Wednesday, June 1, 2011

afterFind not working when array structure is altered

in my afterFind function if I alter values in the array like this:

foreach($results as $key => $data)
{
$results[$key]['Model']['value'] = 'hi';
}
return $results;

Then it works. When I load data from a find() the changes are
reflected.

However when I change the array structure all together:

return array('Foo'=>'bar');

It does not work. The data loaded from find() is as if the afterFind()
function was never called.

Why is this? I am trying to restructure data loaded in afterFind.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: