you might be doing sth wrong
how are you processing the result?

because Reporter__name is correct so far.
cake will then automatically merge the content of this key back to the
Model result array with the key "name".
and then it should be available with
$result['Reporter']['name']

since "name" and "title" have a special meaning (auto-displayField
fields) it might also be related to this.
did you try to use "full_name" as key to eliminate that cause yet?



On 3 Dez., 21:21, aries <br...@allemana.com> wrote:
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to