{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/7138","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/7138/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/7138/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/7138/events","html_url":"https://github.com/yiisoft/yii2/issues/7138","id":56278189,"number":7138,"title":"Bug in join like","user":{"login":"nepster-web","id":5681979,"avatar_url":"https://avatars.githubusercontent.com/u/5681979?v=3","gravatar_id":"","url":"https://api.github.com/users/nepster-web","html_url":"https://github.com/nepster-web","followers_url":"https://api.github.com/users/nepster-web/followers","following_url":"https://api.github.com/users/nepster-web/following{/other_user}","gists_url":"https://api.github.com/users/nepster-web/gists{/gist_id}","starred_url":"https://api.github.com/users/nepster-web/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nepster-web/subscriptions","organizations_url":"https://api.github.com/users/nepster-web/orgs","repos_url":"https://api.github.com/users/nepster-web/repos","events_url":"https://api.github.com/users/nepster-web/events{/privacy}","received_events_url":"https://api.github.com/users/nepster-web/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"milestone":null,"comments":31,"created_at":"2015-02-02T19:02:05Z","updated_at":"2015-03-04T00:12:01Z","closed_at":"2015-03-04T00:12:01Z","body":"I read doc\r\nhttps://github.com/yiisoft/yii2/blob/master/docs/guide/db-query-builder.md:\r\n\r\n```\r\nlike: 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%'. ...\r\n```\r\n\r\nI built my query:\r\n```php\r\n        $name = Yii::$app->request->get('name');\r\n        $categories = Category::find()\r\n            ->joinWith([\r\n                't' => function ($query) use ($name) {\r\n                    $query->where(['like', 'name', $name]);\r\n                },\r\n            ])\r\n            ->asArray()\r\n            ->all();\r\n```\r\n\r\nThis code generates a sql:\r\n```sql\r\nSELECT `product_categories`.* FROM `product_categories` LEFT JOIN `product_category_translates` ON `product_categories`.`category_id` = `product_category_translates`.`category_id` WHERE `name` LIKE '%Электро%''\r\n```\r\n\r\nThe problem is that  the end query has '', but must be '. \r\nWhy this happen?\r\n\r\nMy error:\r\n```\r\nException (Database Exception) 'yii\\db\\Exception' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens\r\nThe SQL being executed was: SELECT `product_categories`.* FROM `product_categories` LEFT JOIN `product_category_translates` ON `product_categories`.`category_id` = `product_category_translates`.`category_id` WHERE `name` LIKE '%Электро%'' \r\n```\r\n\r\n"}}