$orgs = Model_Organisation::find('all', array(
'related' => array(
'address' => array(
'join_type' => 'left'
),
'event' => array(
'join_type' => 'left',
'order_by' => array(
'name' => 'asc'
),
),
),
'order_by' => array(
'type' => 'desc', 'name' => 'asc'
),
'where' => array(
array('user_id', '=', self::$user_id),
// any more where clauses can go here in their own arrays
),
));
SELECT o.name, o_address.post_code, e.name, e_address.post_code FROM cc_organisations AS o LEFT JOIN cc_addresses AS o_address ON o_address.org_id = o.id LEFT OUTER JOIN cc_events AS e ON e.org_id = o.id LEFT JOIN cc_addresses AS e_address ON e_address.org_id = e.id WHERE o.user_id = 1;
It looks like you're new here. If you want to get involved, click one of these buttons!