virtual field in cakephp code example
Example: virtual fields cakphp
$this->virtualFields['myField'] = "CONCAT(language.name, ' (', language.description, ')' )";
return $this->find('list', array(
'fields' => array(
'ImageType.id',
'myField',
),
'conditions' => array(
'ImageType.slug LIKE' => $slug,
),
'joins' => array(
array(
'table' => Environment::read('table_prefix') . 'image_type_languages',
'alias' => 'language',
'type' => 'INNER',
'conditions'=> array(
'ImageType.id = language.image_type_id',
'language.alias = \'' . $language . '\'',
)
),
),
));