diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 41482cd39..a7859ee04 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1730,8 +1730,10 @@ class DboSource extends DataSource { * @return string */ public function renderJoinStatement($data) { - extract($data); - return trim("{$type} JOIN {$table} {$alias} ON ({$conditions})"); + if (strtoupper($data['type']) === 'CROSS') { + return "{$data['type']} JOIN {$data['table']} {$data['alias']}"; + } + return trim("{$data['type']} JOIN {$data['table']} {$data['alias']} ON ({$data['conditions']})"); } /** diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 2cbfaa749..6604aef76 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -1111,8 +1111,14 @@ class DboSourceTest extends CakeTestCase { * * @return array */ - public static function joinStatements($schema) { + public static function joinStatements() { return array( + array(array( + 'type' => 'CROSS', + 'alias' => 'PostsTag', + 'table' => 'posts_tags', + 'conditions' => array('1 = 1') + ), 'CROSS JOIN cakephp.posts_tags AS PostsTag'), array(array( 'type' => 'LEFT', 'alias' => 'PostsTag',