Skip to content
Snippets Groups Projects
Commit 9aec10ee authored by Emircan ERKUL's avatar Emircan ERKUL Committed by Aaron Bauman
Browse files

Issue #3410886 by emircanerkul, AaronBauman: Add option to SelectQuery condition

parent 8979e2b6
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
...@@ -59,11 +59,15 @@ class SelectQuery implements SelectQueryInterface { ...@@ -59,11 +59,15 @@ class SelectQuery implements SelectQueryInterface {
*/ */
public function __construct($object_type = '') { public function __construct($object_type = '') {
$this->objectType = $object_type; $this->objectType = $object_type;
$this->conjunction = 'AND';
} }
/** /**
* Add a condition to the query. * Add a condition to the query.
* *
* Conditions will be combined with the conjunction defined by
* $this->conjunction. Defaults to 'AND'.
*
* @param string $field * @param string $field
* Field name. * Field name.
* @param mixed $value * @param mixed $value
...@@ -100,6 +104,8 @@ class SelectQuery implements SelectQueryInterface { ...@@ -100,6 +104,8 @@ class SelectQuery implements SelectQueryInterface {
* Implements PHP's magic toString(). * Implements PHP's magic toString().
* *
* Function to convert the query to a string to pass to the SF API. * Function to convert the query to a string to pass to the SF API.
* Conditions will be combined with the conjunction defined by
* $this->conjunction. Defaults to 'AND'.
* *
* @return string * @return string
* SOQL query ready to be executed the SF API. * SOQL query ready to be executed the SF API.
...@@ -116,7 +122,7 @@ class SelectQuery implements SelectQueryInterface { ...@@ -116,7 +122,7 @@ class SelectQuery implements SelectQueryInterface {
foreach ($this->conditions as $condition) { foreach ($this->conditions as $condition) {
$where[] = implode('+', $condition); $where[] = implode('+', $condition);
} }
$query .= '+WHERE+' . implode('+AND+', $where); $query .= '+WHERE+' . implode('+' . $this->conjunction . '+', $where);
} }
if ($this->order) { if ($this->order) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment