Using UNION syntax in CakePHP 2.4.6

Author - Manju Kashyap

Following UNION syntax works properly in CakePHP 2.4.6 version but it doesn’t work in CakePHP 2.5.2 version:

$unionQuery = $dbo->buildStatement
    (
    array(
	  'fields' => array( required fields),
	  'table' => $dbo->fullTableName(database_table_name),
	  'alias' => 'customObject1',
	  'limit' => null,
	  'offset' => null,
	  'joins' => $joins,
	  'conditions' => $conditions,
	  'order' => null,
	  'group' => null
	  ),
	  $this->customObject1
     );
$unionQuery .= ' UNION ';
$unionQuery .= $dbo->buildStatement(
array
(
'fields' => array(required fields),
'table' => $dbo->fullTableName(manage_course_payment_users),
'alias' => 'customObject2',
'limit' => null,
'offset' => null,
'joins' => $joins,
'conditions' => $conditions,
'order' => null,
'group' => null
),
$this->customObject2
);
$result = $this->query($query);
Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *