-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for IN (array)
condition with update()
and delete()
#6702
base: 4.3.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to fix Line exceeds 120 characters
violations
Is using linebreaks not an option? SInce this is a new feature, you should target 4.3.x |
phpcs does not parse linebreaks in unions |
What about linebreaks outside unions? I think it works for array values, for instance. |
Yup, linebreaks within arrayshapes are supported. Linebreaking array<> syntax causes errors in other sniffs. I used |
* @param array<string, mixed> $criteria | ||
* @param array<int<0,max>, string|ParameterType|Type>|array<string, string|ParameterType|Type> $types | ||
* @param array<string, mixed> $criteria | ||
* @param array<int<0,max>, WrapperParameterType>|array<string, WrapperParameterType> $types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this is a breaking changes for extending classes, however I think it's not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be documented though.
$columns[] = $columnName; | ||
$values[] = $value; | ||
$conditions[] = $columnName . ' = ?'; | ||
if (is_array($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot guess that an IN
query must be used based on the value being an array. This would break types that map to a PHP array like JSON
for instance.
We should add a functional test instead. |
Summary
This add support for
WHERE IN (?, ?...)
condition using$connection->update()
anddelete()
methods.I was looking for a reason it is not implemented yet in issues and tests but did not find any. IMO it's viable. 🤔