Cake 2.0 Virtual Fields
Hello,
I'm trying to use virtual fields with Cake 2.0 and am running into a
problem. I'm trying to populate a select input with values from a
table that has no `name` field. I'm setting a virtual field called
`name` with the first_name and last_name fields, but the menu is not
populating properly.
In my model I have simply:
public $virtualFields = array(
'name' => "CONCAT(Reporter.first_name, ' ', Reporter.last_name)"
);
But when Cake does a find operation, the sql looks like this:
SELECT `Reporter`.`id`, `Reporter`.`first_name`,
`Reporter`.`last_name`, (CONCAT(`Reporter`.`first_name`, ' ',
`Reporter`.`last_name`)) AS `Reporter__name`
Calling the field alias `Reporter__name`, which then doesn't register
with select inputs. Is this expected behavior? Any recommended
solutions to my problem?
Thanks,
-Brian
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home