{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/11611","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/11611/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/11611/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/11611/events","html_url":"https://github.com/yiisoft/yii2/issues/11611","id":156159467,"number":11611,"title":"Query builder between 2 columns","user":{"login":"wartur","id":1358236,"avatar_url":"https://avatars.githubusercontent.com/u/1358236?v=3","gravatar_id":"","url":"https://api.github.com/users/wartur","html_url":"https://github.com/wartur","followers_url":"https://api.github.com/users/wartur/followers","following_url":"https://api.github.com/users/wartur/following{/other_user}","gists_url":"https://api.github.com/users/wartur/gists{/gist_id}","starred_url":"https://api.github.com/users/wartur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wartur/subscriptions","organizations_url":"https://api.github.com/users/wartur/orgs","repos_url":"https://api.github.com/users/wartur/repos","events_url":"https://api.github.com/users/wartur/events{/privacy}","received_events_url":"https://api.github.com/users/wartur/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:under%20discussion","name":"status:under discussion","color":"f7c6c7"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:enhancement","name":"type:enhancement","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/9","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.x","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/9/labels","id":831720,"number":9,"title":"2.0.x","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":400,"closed_issues":2,"state":"open","created_at":"2014-10-19T13:49:45Z","updated_at":"2016-10-05T09:15:08Z","due_on":null,"closed_at":null},"comments":40,"created_at":"2016-05-22T16:14:17Z","updated_at":"2016-10-05T09:24:14Z","closed_at":null,"body":"Предлагаю фичу, ну или как минимум дописать документацию.\r\n\r\nВ документации:\r\nhttp://www.yiiframework.com/doc-2.0/yii-db-query.html\r\n\r\nНаписано:\r\n> between: operand 1 should be the column name, and operand 2 and 3 should be the starting and ending values of the range that the column is in. For example, ['between', 'id', 1, 10] will generate id BETWEEN 1 AND 10.\r\n\r\nМожно ли сделать поддержку следующего?\r\n$this->where(['between', $value, 'column_from', 'column_to'])->all();\r\n\r\nКак я читал SQL подобную конструкцию поддерживает. MySQL поддерживает подобный синтаксис.\r\n```SQL\r\nSELECT * FROM  `mytable` \r\nWHERE 4 \r\nBETWEEN  `from` AND  `to`\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/251625373","html_url":"https://github.com/yiisoft/yii2/issues/11611#issuecomment-251625373","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/11611","id":251625373,"user":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T09:24:14Z","updated_at":"2016-10-05T09:24:14Z","body":"> По умолчанию все всегда определяются как колонки, а если надо значения - они могут быть введены через Expression\r\n\r\nДа нет же. Зачем пользователя заставлять эскейпить строку вручную и засовывать ее в Expression?\r\n\r\n\r\n\r\n> Т.е. такой запрос -\r\n> \r\n> SELECT * FROM table WHERE column1 BETWEEN column2 AND column3;\r\n> я опять не сделаю?\r\n\r\nСделаешь\r\n`['betweenColumns', new \\yii\\db\\Expression('column1'), 'column2', 'column3']`"}}
{"actor":{"display_login":"SilverFire"}}