I wanted to use a select query condition with OR not always with AND.

This is a temporary improvement and it should have a condition group suggested here but needs more work.

Example usage;

$user_query = new SelectQuery('Account');
$user_query->conditionGlue = ConditionGlue::OR;
$user_query->fields = ['Id'];
$user_query->limit = 1;
$user_query->order['LastModifiedDate'] = 'DESC';
$user_query->addCondition('xxx', [$xxx]);
$user_query->addCondition('yyy', [$yyy]);
$user_query->addCondition('zzz', [$zzz]);
$user_query_response = $this->salesforceClient->query($user_query);

Issue fork salesforce-3410886

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

emircanerkul created an issue. See original summary.

emircanerkul’s picture

Assigned: emircanerkul » Unassigned
Status: Active » Needs review
emircanerkul’s picture

And if you need more complex condition

$query = new SelectQuery('MyObj__c');
$query->conditions[] = ["Foo = 'bar' OR (zee = 'bang' and foobar > 1)"]

https://www.drupal.org/project/salesforce/issues/2879844#comment-12094587

aaronbauman’s picture

enum is overkill. these can be new constants on SelectQuery

aaronbauman’s picture

Status: Needs review » Fixed

in fact, i don't think even constants are overkill.

it's a new public string property, defaulted to 'AND' on construct

committed, thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.