You are here

public function SalesforceSelectQuery::addCondition in Salesforce Suite 7.3

Add a condition to the query.

Parameters

string $field: Field name.

mixed $value: Condition value. If an array, it will be split into quote enclosed strings separated by commas inside of parenthesis. Note that the caller must enclose the value in quotes as needed by the SF API.

string $operator: Conditional operator. One of '=', '!=', '<', '>', 'LIKE, 'IN', 'NOT IN'.

File

includes/salesforce.select_query.inc, line 38
Class representing a Salesforce SELECT SOQL query.

Class

SalesforceSelectQuery
@file Class representing a Salesforce SELECT SOQL query.

Code

public function addCondition($field, $value, $operator = '=') {
  if (is_array($value)) {
    $value = "('" . implode("','", $value) . "')";

    // Set operator to IN if wasn't already changed from the default.
    if ($operator == '=') {
      $operator = 'IN';
    }
  }
  $this->conditions[] = array(
    'field' => $field,
    'operator' => $operator,
    'value' => $value,
  );
}