I'm trying to create a virtual field to use in find('list') on the Aro
model in cakes Acl component. Since I'd rather not mess with the Acl
files directly, I created the virtual field in a controller when I
needed it, something like this:
Aro->virtualFields = array ('name' => "CONCAT(id, \": \", alias)");
This does create the virtual field, but not in the array with the
other fields. Here's what I get:
Array
(
[Aro] => Array
(
[id] => 1
[parent_id] =>
[model] => Group
[foreign_key] => 1
[alias] => administrators
[lft] => 1
[rght] => 4
)
[0] => Array
(
[Aro__name] => 1: administrators
)
This makes the find('list') result return a set of empty elements.
If I edit the Aro model directly to create the virtual field like
this:
var $virtualFields = array(
'indexed_name' => 'CONCAT(Aro.id, ": ", Aro.alias)'
);
I get what I would expect:
Array
(
[Aro] => Array
(
[id] => 1
[parent_id] =>
[model] => Group
[foreign_key] => 1
[alias] => administrators
[lft] => 1
[rght] => 4
[indexed_name] => 1: administrators
)
That doesn't seem like a good solution though. Any suggestions?
Don
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php