How to select a specific field additionally to a tables default fields?

后端 未结 2 1374
北海茫月
北海茫月 2020-12-11 05:55

I an looking to use a JOIN to select data from a table and a view in CakePHP like so :

$this->Annonces->find(\'all\')
        ->where($arrFiltres)
          


        
2条回答
  •  臣服心动
    2020-12-11 06:14

    You also can create virtual field in Entity:

    namespace App\Model\Entity;
    use Cake\ORM\Entity;
    
    class User extends Entity { 
        protected function _getFullName() {
           return $this->_properties['first_name'] . ' ' . $this->_properties['last_name']; 
        } 
    }
    

    echo $entity->full_name;

提交回复
热议问题