Closed Barton0403 closed 2 years ago
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Fixed issues |
Hi! Thank you for your contribution. Could you make a few tiny changes to make this behave like the standard "like" query? To quote [the docs](https://www.yiiframework.com/doc/api/2.0/yii-db-queryinterface#where()-detail):
Operand 1 should be a column or DB expression, and operand 2 be a string or an array representing the values that the column or DB expression should be like. For example, ['like', 'name', 'tester'] will generate name LIKE '%tester%'. When the value range is given as an array, multiple LIKE predicates will be generated and concatenated using AND. For example, ['like', 'name', ['test', 'sample']] will generate name LIKE '%test%' AND name LIKE '%sample%'. The method will properly quote the column name and escape special characters in the values. Sometimes, you may want to add the percentage characters to the matching value by yourself, you may supply a third operand false to do so. For example, ['like', 'name', '%tester', false] will generate name LIKE '%tester'.
Can you make sure that:
foo
becomes *foo*
?Thank you so much!
Sorry, after the test, I found the wildcard
was not like like
. If I search for yii*
, I still get I love yii!
. So I decide not to implement like
query.