{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/6985","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/6985/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/6985/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/6985/events","html_url":"https://github.com/yiisoft/yii2/issues/6985","id":55295452,"number":6985,"title":"orOnCondition not set OR","user":{"login":"Tahiaji","id":2605542,"avatar_url":"https://avatars.githubusercontent.com/u/2605542?v=3","gravatar_id":"","url":"https://api.github.com/users/Tahiaji","html_url":"https://github.com/Tahiaji","followers_url":"https://api.github.com/users/Tahiaji/followers","following_url":"https://api.github.com/users/Tahiaji/following{/other_user}","gists_url":"https://api.github.com/users/Tahiaji/gists{/gist_id}","starred_url":"https://api.github.com/users/Tahiaji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tahiaji/subscriptions","organizations_url":"https://api.github.com/users/Tahiaji/orgs","repos_url":"https://api.github.com/users/Tahiaji/repos","events_url":"https://api.github.com/users/Tahiaji/events{/privacy}","received_events_url":"https://api.github.com/users/Tahiaji/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-23T15:38:59Z","updated_at":"2015-01-23T16:43:28Z","closed_at":"2015-01-23T16:43:28Z","body":"I have two tables. For example user ang engage(have 2 related fields user1,user2). \r\n\r\nWhen I try write relation:\r\n public function getEngages() {\r\n        return $this->hasMany(Engage::className(), ['user1' => 'id'])->orOnCondition(['user2' => $this->id]);       \r\n    }\r\nit generates code:\r\nSELECT * FROM `engage` WHERE (`user1`=1) AND (`user2`=1)\","}}