Re: A "Virtual Fields" solution using afterFind
Thanks for the reply. I commented out the constructor and am no longer seeing the error. However, I have this function in my model: function addFieldDisplayName($x) { return $x['ln'].', '.$x['fn']; } But when I try this in my controller it doesn't work: $this->set('contacts', $this->Address->Contact->generateList(NULL, NULL, NULL, '{n}.Contact.id', '{n}.Contact.DisplayName')); Shouldn't the addFieldDisplayName() function allow me to use the {n}.Contact.DisplayName placeholder? Instead, I get the proper id values in my option tags, but nothing in the text portion (between the I mean). Many thanks, again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: A "Virtual Fields" solution using afterFind
You can take out the constructor. You don't need it. It's for something else. /* public function __construct() { vendor('mylib/Url'); parent::__construct(); } */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: A "Virtual Fields" solution using afterFind
I am getting a Warning when I try to implement this code: cake/vendors/mylib/Url.php "failed to open stream: No such file or directory in..." Looks like a need the Url.php file in order to use this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: A "Virtual Fields" solution using afterFind
Oh, yeah. Stupid PHP4 and get_class_methods. Possible solution using... http://us2.php.net/get_class_methods#57842 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: A "Virtual Fields" solution using afterFind
As per the php doc... As of PHP 5, this function returns the name of the methods as they were declared (case-sensitive). In PHP 4 they were lowercased. Seb. On Jan 22, 9:55 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Crap, I'm stupid. The example method should be... > > function addFieldFullName($x) { > return $x['first_name'] . ' ' . $x['last_name']; > > }My bad! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: A "Virtual Fields" solution using afterFind
Crap, I'm stupid. The example method should be... function addFieldFullName($x) { return $x['first_name'] . ' ' . $x['last_name']; } My bad! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
A "Virtual Fields" solution using afterFind
Thought this might help someone. If you refactor, please post. I haven't tested in all conditions, though I know it works at least in 1-level recursion. The idea is to be able to dynamically add fields to any of your models (with the smallest footprint)... ie. $full_name = $first_name . ' ' . $last_name; Here's the app_model.php base class. http://viewvc.churchalive.biz/viewvc/dev.godinvite.com/httpdocs/app/app_model.php?view=co And here's an example model: http://viewvc.churchalive.biz/viewvc/dev.godinvite.com/httpdocs/app/models/template.php?view=co So, using the above "full_name" example in a model class called "Person", you'd add the method... function addFieldFullName($x) { return $x['full_name'] = $x['first_name'] . ' ' . $x['last_name']; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---