I’ve used orConditionGroups with queries before. Specifically with entity queries. But now I have a custom sql table I created separate from drupal but still on the same database I have access to. I want to update a row if any of the fields are different but I’m having generating the or statement. Here was my attempt.
$ connection = \Drupal::database(); $ orConditionGroup = $ connection->orConditionGroup()->condition('address', $ fulladdress, '!=')->condition('full_name', $ fullname, '!=')->condition('telephone', $ workphone, '!='); $ connection->update($ table)->fields(['full_name' => $ fullname, 'address' => $ fulladdress, 'telephone' => $ workphone, 'email' => $ email])->condition('id', $ id)->condition($ orConditionGroup);
But I get the error
undefined method Drupal\Core\Database\Driver\mysql\Connection::condition()
Which makes sense since the connection class isn’t a query object on its own, but not sure how else to tackle this. How would I create an orConditionGroup for just a plain direct sql query that isn’t a drupal entity or anything like that?