CakePHP 1.3 - Unknown column in where clause

前端 未结 5 750
情话喂你
情话喂你 2021-01-18 02:02

I\'m working on an already existing cakephp 1.3 project and I needed to add a new table to the database. I have this in my controller:

    $conditions = arra         


        
5条回答
  •  礼貌的吻别
    2021-01-18 02:30

    This would provide the required join:

    $conditions = array('ShootingPlacement.person_id' => $id, 'Email.person_id' => $id, 'Email.shooting_placement_id' => 'ShootingPlacement.id');
    
    $joins = array(
       array(
        'table' => 'emails', 
        'alias' => 'Email', 
        'type' => 'LEFT', 
        'conditions' => array('Email.shooting_placement_id = ShootingPlacement.id')
      )
    ); 
    
    
    
    $shootingPlacements = $this->ShootingPlacement->find('all', 
       array(
          'conditions' => $conditions,
          'joins' => $joins
       )
    );
    

提交回复
热议问题