virtual fields cakphp

Solutions on MaxInterview for virtual fields cakphp by the best coders in the world

showing results for - "virtual fields cakphp"
Rafael
24 Feb 2020
1
2// ------------------- CONCAT USE virtualFields
3$this->virtualFields['myField'] = "CONCAT(language.name, ' (', language.description,  ')' )";	// using this for use concat
4		
5return $this->find('list', array(
6    'fields' => array(
7        'ImageType.id', 
8        'myField',
9    ),
10    'conditions' => array(
11        'ImageType.slug LIKE' => $slug,
12    ),
13    'joins' => array(
14        array(
15            'table' => Environment::read('table_prefix') . 'image_type_languages', 
16            'alias' => 'language',
17            'type' => 'INNER',
18            'conditions'=> array(
19                'ImageType.id = language.image_type_id',
20                'language.alias = \'' . $language . '\'',
21            )
22        ),
23    ),
24));