SELECT `t0`.`id` AS `t0_c0`, `t0`.`name` AS `t0_c1`, `t0`.`is_default` AS `t0_c2`, `t0`.`created_by` AS `t0_c3` , `t0`.`deleted` AS `t0_c4`, `t0`.`created_at` AS `t0_c5`, `t0`.`updated_at` AS `t0_c6`, `t1`.`id` AS `t1_c0` , `t1`.`interviewprenatal_id` AS `t1_c1`, `t1`.`prenataltopics_id` AS `t1_c2`, `t1`.`is_checked` AS `t1_c3` , `t1`.`created_at` AS `t1_c4`, `t1`.`updated_at` AS `t1_c5` FROM `prenataltopics` AS `t0` LEFT JOIN `interviewprenataltopics` AS `t1` ON (`t0`.`id` = `t1`.`prenataltopics_id`) WHERE `t0`.`is_default` = '1' AND `t0`.`deleted` = '0'
LEFT JOIN `interviewprenataltopics` AS `t1` ON (`t0`.`id` = `t1`.`prenataltopics_id`) and `t1`.`interviewprenatal_id` = 2
$PrenatalFactors = OrmPrenatalfactor::find("all", array('where' => array('is_default' => '1', 'deleted' => '0') ,'related' => array( 'interviewprenatalfactor' => array( 'join_on' => array( array('interviewprenatal_id','=',$Patient->interviewprenatal->id)), ), ) ));
$PrenatalFactors = OrmPrenatalfactor::find() ->related('interviewprenatalfactor') ->where(array('is_default' => '1', 'deleted' => '0')) ->where_open() ->where('interviewprenatal_id', '=', $Patient->interviewprenatal->id) ->or_where('interviewprenatal', 'is null') ->where_close() ->get();
It looks like you're new here. If you want to get involved, click one of these buttons!