sql - join 3 tables on cakephp -
i'm trying join 3 tables using cakephp don't understand why when execute query there result of main tables without attributes other 2 tables . php code :
$flightschedule = $this->flightschedules->find('all', array( 'join' => array( array( 'table' => 'weeklyschedules', 'alias' => 'ws', 'type' => 'inner', 'conditions' => array( 'flightschedules.code = ws.flight_plan_code' ), array( 'table' => 'structures', 'alias' => 's', 'type' => 'left', 'conditions' => array( 'flightschedules.code = s.flight_plan_code', )), )), 'conditions' => array( 'flightschedules.plane_code' => 'xxx' ), ));
the result of flightschedules record without join of other tables . ideas how fix ?
use "fields" display data of associated table .
$flightschedule = $this->flightschedules->find('all', array( 'join' => array( array( 'table' => 'weeklyschedules', 'alias' => 'ws', 'type' => 'inner', 'conditions' => array( 'flightschedules.code = ws.flight_plan_code' ), array( 'table' => 'structures', 'alias' => 's', 'type' => 'left', 'conditions' => array( 'flightschedules.code = s.flight_plan_code', )), )), 'conditions' => array( 'flightschedules.plane_code' => 'xxx' ), 'fields'=>'flightschedules.*,ws.*,s.*' ));
Comments
Post a Comment