Showing posts with label virtualFields. Show all posts
Showing posts with label virtualFields. Show all posts

Wednesday, September 4, 2013

Concat two different fields in cakephp in find statement

<?php
$this
->ModelName->virtualFields = array(
    
'full_name' => "CONCAT(ModelName.first_name, ' ', ModelName.last_name)"

);
$list $this->ModelName->find("all", array(
    
"fields" => array(
        
"ModelName.id",
        
"ModelName.full_name"
    
)
));

?>