- Issue created by @dewalt
- 🇮🇳India himanshu_jhaloya Indore
It seems like you're encountering an issue with parameter expansion in your where condition when using an array placeholder (:names[]) in your update query. This might be due to a change in behavior between Drupal 9.2 and 9.5. To resolve this, you can try a different approach to handle the array of values in the where condition.
One possible solution is to use the condition() method instead of directly specifying the where condition. Here's how you can modify your code to use condition():
$query = \Drupal::database()->update("users_field_data");
$query->expression("name", "LOWER(name)");// Use condition() to specify the WHERE clause with an array of names.
$query->condition('name', ['admin', 'user_1'], 'IN');// Execute the query.
$result = $query->execute();This way, you explicitly specify the IN condition and provide the array of names directly to the condition() method. This should avoid the issue you're encountering with parameter expansion.
- 🇧🇾Belarus dewalt
Thanks @himanshu_jhaloya, but "::condition()" methods doesn't support MySQL expressions, simple query is provided as example only. For a cases when expressions are used in conditions looks like only "::where()" method works, e.g. "WHERE BINARY value = IN (:arg[])" or for binary (case-sensitive) columns "WHERE LOWER(value) IN (:args[])", and many other possible expressions.