## The question > The last `andWhere()` method adds a LIKE condition with one percentage sign at the right. I'm wondering if there a better way to do it. As [this StackOverflow answer](https://stackoverflow.com/a/58114026/1575353) suggests, a bound parameter could still be used with the `LIKE` condition - then you might not need to escape as many characters: $query->andWhere(new \yii\db\Expression('name LIKE :city_name', [':city_name' => $city_name . '%'])); But if the presence of certain characters like `%` in the city name still present a problem then continue to escape them ## Other feedback The code is very easy to read. Perhaps it was written to be compliant with [PSR-2](https://www.php-fig.org/psr/psr-2/), which is now deprecated<sup>[1](https://www.php-fig.org/psr/psr-2/)</sup>, though it mostly is compliant with [PSR-12](https://www.php-fig.org/psr/psr-12/). I see it contains assignment within the conditionals - e.g. > if ($city_id = \Yii::$app->request->getQueryParam('city_id')) While it doesn't take much to notice that the variables are later used within the statement that follows, it might be nice to help readers with a comment above the group that says something like `intentional assignment`.