CakePHP – To display two or more fields in displayField
Model class UserDetail extends AppModel { public $virtualFields = array( ‘collector_name’ => ‘CONCAT(UserDetail.first_name, ” “, UserDetail.middle_name, ” “, UserDetail.last_name)’); public $displayField= “collector_name”; } Controller $userDetails = $this->CustomerSubscription->UserDetail->find(‘list’, array(‘conditions’=> array(‘UserDetail.department_id’=>’2’))); $this->set(compact(‘userDetails’));