Tuesday, June 5, 2012

Re: afterFind is weird with associations

http://book.cakephp.org/2.0/en/models/callback-methods.html#afterfind 

if you look here
second parameter is $primary
this means, if this is set to true, than "afterFind()" si called in main model, if is false, this model is called as associated

this can help you to modify data as you want

PS: if I don't understand you correctly, soory :)
--
Lep pozdrav, Tilen Majerle



2012/6/5 Benjamin Allison <benjamin.samuel.allison@gmail.com>
So afterFind works fine and dandy when I'm within the corresponding model/controller. However, when calling an associated model, the data sent to the afterFind callback is formatted differently. This causes afterFind to crap out because it can't find the same array indexes it did when just working within the original model/controller.

Anyone know why, or what a fix might be?

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

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