{"action":"created","comment":{"url":"https://api.github.com/repos/nette/database/pulls/comments/46995821","id":46995821,"diff_hunk":"@@ -334,6 +334,33 @@ public function where($condition, ...$params)\n \t\treturn $this;\n \t}\n \n+\t/**\n+\t * Adds where condition using the OR operator between parameters.\n+\t * More calls appends with AND.\n+\t * @param  array ['column1' => 1, 'column2 > ?' => 2, 'full condition']\n+\t * @return self\n+\t */\n+\tpublic function whereOr(array $parameters)\n+\t{\n+\t\tif (count($parameters) < 2) {\n+\t\t\treturn $this->where($parameters);\n+\t\t}\n+\t\t$columns = [];\n+\t\t$values = [];\n+\t\tforeach ($parameters as $key => $val) {\n+\t\t\tif (is_int($key)) { // whereOr(['full condition'])\n+\t\t\t\t$columns[] = $val;\n+\t\t\t} else if (strpos($key, \"?\") === FALSE) { // whereOr(['column1' => 1])\n+\t\t\t\t$columns[] = $key . \" ?\";\n+\t\t\t\t$values[] = $val;\n+\t\t\t} else { // whereOr(['column1 > ?' => 1])\n+\t\t\t\t$columns[] = $key;\n+\t\t\t\t$values[] = $val;","path":"src/Database/Table/Selection.php","position":25,"original_position":25,"commit_id":"440577dd91ae0e5ef8411797e8c9afadcca8c003","original_commit_id":"440577dd91ae0e5ef8411797e8c9afadcca8c003","user":{"login":"matej21","id":1276059,"avatar_url":"https://avatars.githubusercontent.com/u/1276059?v=3","gravatar_id":"","url":"https://api.github.com/users/matej21","html_url":"https://github.com/matej21","followers_url":"https://api.github.com/users/matej21/followers","following_url":"https://api.github.com/users/matej21/following{/other_user}","gists_url":"https://api.github.com/users/matej21/gists{/gist_id}","starred_url":"https://api.github.com/users/matej21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matej21/subscriptions","organizations_url":"https://api.github.com/users/matej21/orgs","repos_url":"https://api.github.com/users/matej21/repos","events_url":"https://api.github.com/users/matej21/events{/privacy}","received_events_url":"https://api.github.com/users/matej21/received_events","type":"User","site_admin":false},"body":"I think, this should also support multiple parameters, e.g.\r\n`['SOME_FN(column, ?, ?)' => [1, 2]]`\r\n\r\nmaybe this way?\r\n\r\n```php\r\n$values = array_merge($values, substr_count($key, '?') > 1 ? $val : [$val]);\r\n```","created_at":"2015-12-08T18:52:21Z","updated_at":"2015-12-08T18:52:21Z","html_url":"https://github.com/nette/database/pull/111#discussion_r46995821","pull_request_url":"https://api.github.com/repos/nette/database/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/nette/database/pulls/comments/46995821"},"html":{"href":"https://github.com/nette/database/pull/111#discussion_r46995821"},"pull_request":{"href":"https://api.github.com/repos/nette/database/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/nette/database/pulls/111","id":52866920,"html_url":"https://github.com/nette/database/pull/111","diff_url":"https://github.com/nette/database/pull/111.diff","patch_url":"https://github.com/nette/database/pull/111.patch","issue_url":"https://api.github.com/repos/nette/database/issues/111","number":111,"state":"open","locked":false,"title":"Selection: added new method whereOr","user":{"login":"meridius","id":372431,"avatar_url":"https://avatars.githubusercontent.com/u/372431?v=3","gravatar_id":"","url":"https://api.github.com/users/meridius","html_url":"https://github.com/meridius","followers_url":"https://api.github.com/users/meridius/followers","following_url":"https://api.github.com/users/meridius/following{/other_user}","gists_url":"https://api.github.com/users/meridius/gists{/gist_id}","starred_url":"https://api.github.com/users/meridius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meridius/subscriptions","organizations_url":"https://api.github.com/users/meridius/orgs","repos_url":"https://api.github.com/users/meridius/repos","events_url":"https://api.github.com/users/meridius/events{/privacy}","received_events_url":"https://api.github.com/users/meridius/received_events","type":"User","site_admin":false},"body":"- feature\r\n- documentation - needed: nette/web-content#404\r\n- BC break - no\r\n\r\nThis feature will make creating the OR-ed where conditions easier by passing an (associative) array as its parameter.","created_at":"2015-12-07T16:30:04Z","updated_at":"2015-12-08T18:52:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1a84b3b0850840066ec7a6c365243a1eca73223","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nette/database/pulls/111/commits","review_comments_url":"https://api.github.com/repos/nette/database/pulls/111/comments","review_comment_url":"https://api.github.com/repos/nette/database/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nette/database/issues/111/comments","statuses_url":"https://api.github.com/repos/nette/database/statuses/440577dd91ae0e5ef8411797e8c9afadcca8c003","head":{"label":"meridius:added-whereor","ref":"added-whereor","sha":"440577dd91ae0e5ef8411797e8c9afadcca8c003","user":{"login":"meridius","id":372431,"avatar_url":"https://avatars.githubusercontent.com/u/372431?v=3","gravatar_id":"","url":"https://api.github.com/users/meridius","html_url":"https://github.com/meridius","followers_url":"https://api.github.com/users/meridius/followers","following_url":"https://api.github.com/users/meridius/following{/other_user}","gists_url":"https://api.github.com/users/meridius/gists{/gist_id}","starred_url":"https://api.github.com/users/meridius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meridius/subscriptions","organizations_url":"https://api.github.com/users/meridius/orgs","repos_url":"https://api.github.com/users/meridius/repos","events_url":"https://api.github.com/users/meridius/events{/privacy}","received_events_url":"https://api.github.com/users/meridius/received_events","type":"User","site_admin":false},"repo":{"id":42245673,"name":"database","full_name":"meridius/database","owner":{"login":"meridius","id":372431,"avatar_url":"https://avatars.githubusercontent.com/u/372431?v=3","gravatar_id":"","url":"https://api.github.com/users/meridius","html_url":"https://github.com/meridius","followers_url":"https://api.github.com/users/meridius/followers","following_url":"https://api.github.com/users/meridius/following{/other_user}","gists_url":"https://api.github.com/users/meridius/gists{/gist_id}","starred_url":"https://api.github.com/users/meridius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meridius/subscriptions","organizations_url":"https://api.github.com/users/meridius/orgs","repos_url":"https://api.github.com/users/meridius/repos","events_url":"https://api.github.com/users/meridius/events{/privacy}","received_events_url":"https://api.github.com/users/meridius/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/meridius/database","description":"Nette Database layer","fork":true,"url":"https://api.github.com/repos/meridius/database","forks_url":"https://api.github.com/repos/meridius/database/forks","keys_url":"https://api.github.com/repos/meridius/database/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meridius/database/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meridius/database/teams","hooks_url":"https://api.github.com/repos/meridius/database/hooks","issue_events_url":"https://api.github.com/repos/meridius/database/issues/events{/number}","events_url":"https://api.github.com/repos/meridius/database/events","assignees_url":"https://api.github.com/repos/meridius/database/assignees{/user}","branches_url":"https://api.github.com/repos/meridius/database/branches{/branch}","tags_url":"https://api.github.com/repos/meridius/database/tags","blobs_url":"https://api.github.com/repos/meridius/database/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meridius/database/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meridius/database/git/refs{/sha}","trees_url":"https://api.github.com/repos/meridius/database/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meridius/database/statuses/{sha}","languages_url":"https://api.github.com/repos/meridius/database/languages","stargazers_url":"https://api.github.com/repos/meridius/database/stargazers","contributors_url":"https://api.github.com/repos/meridius/database/contributors","subscribers_url":"https://api.github.com/repos/meridius/database/subscribers","subscription_url":"https://api.github.com/repos/meridius/database/subscription","commits_url":"https://api.github.com/repos/meridius/database/commits{/sha}","git_commits_url":"https://api.github.com/repos/meridius/database/git/commits{/sha}","comments_url":"https://api.github.com/repos/meridius/database/comments{/number}","issue_comment_url":"https://api.github.com/repos/meridius/database/issues/comments{/number}","contents_url":"https://api.github.com/repos/meridius/database/contents/{+path}","compare_url":"https://api.github.com/repos/meridius/database/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meridius/database/merges","archive_url":"https://api.github.com/repos/meridius/database/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meridius/database/downloads","issues_url":"https://api.github.com/repos/meridius/database/issues{/number}","pulls_url":"https://api.github.com/repos/meridius/database/pulls{/number}","milestones_url":"https://api.github.com/repos/meridius/database/milestones{/number}","notifications_url":"https://api.github.com/repos/meridius/database/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meridius/database/labels{/name}","releases_url":"https://api.github.com/repos/meridius/database/releases{/id}","created_at":"2015-09-10T13:19:12Z","updated_at":"2015-09-10T13:19:13Z","pushed_at":"2015-12-08T18:29:58Z","git_url":"git://github.com/meridius/database.git","ssh_url":"git@github.com:meridius/database.git","clone_url":"https://github.com/meridius/database.git","svn_url":"https://github.com/meridius/database","homepage":"http://nette.org","size":1036,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nette:master","ref":"master","sha":"9f4b82984416e3f3717bec7270860c5474b42c5d","user":{"login":"nette","id":99965,"avatar_url":"https://avatars.githubusercontent.com/u/99965?v=3","gravatar_id":"","url":"https://api.github.com/users/nette","html_url":"https://github.com/nette","followers_url":"https://api.github.com/users/nette/followers","following_url":"https://api.github.com/users/nette/following{/other_user}","gists_url":"https://api.github.com/users/nette/gists{/gist_id}","starred_url":"https://api.github.com/users/nette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nette/subscriptions","organizations_url":"https://api.github.com/users/nette/orgs","repos_url":"https://api.github.com/users/nette/repos","events_url":"https://api.github.com/users/nette/events{/privacy}","received_events_url":"https://api.github.com/users/nette/received_events","type":"Organization","site_admin":false},"repo":{"id":17713908,"name":"database","full_name":"nette/database","owner":{"login":"nette","id":99965,"avatar_url":"https://avatars.githubusercontent.com/u/99965?v=3","gravatar_id":"","url":"https://api.github.com/users/nette","html_url":"https://github.com/nette","followers_url":"https://api.github.com/users/nette/followers","following_url":"https://api.github.com/users/nette/following{/other_user}","gists_url":"https://api.github.com/users/nette/gists{/gist_id}","starred_url":"https://api.github.com/users/nette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nette/subscriptions","organizations_url":"https://api.github.com/users/nette/orgs","repos_url":"https://api.github.com/users/nette/repos","events_url":"https://api.github.com/users/nette/events{/privacy}","received_events_url":"https://api.github.com/users/nette/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nette/database","description":"Nette Database layer","fork":false,"url":"https://api.github.com/repos/nette/database","forks_url":"https://api.github.com/repos/nette/database/forks","keys_url":"https://api.github.com/repos/nette/database/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nette/database/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nette/database/teams","hooks_url":"https://api.github.com/repos/nette/database/hooks","issue_events_url":"https://api.github.com/repos/nette/database/issues/events{/number}","events_url":"https://api.github.com/repos/nette/database/events","assignees_url":"https://api.github.com/repos/nette/database/assignees{/user}","branches_url":"https://api.github.com/repos/nette/database/branches{/branch}","tags_url":"https://api.github.com/repos/nette/database/tags","blobs_url":"https://api.github.com/repos/nette/database/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nette/database/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nette/database/git/refs{/sha}","trees_url":"https://api.github.com/repos/nette/database/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nette/database/statuses/{sha}","languages_url":"https://api.github.com/repos/nette/database/languages","stargazers_url":"https://api.github.com/repos/nette/database/stargazers","contributors_url":"https://api.github.com/repos/nette/database/contributors","subscribers_url":"https://api.github.com/repos/nette/database/subscribers","subscription_url":"https://api.github.com/repos/nette/database/subscription","commits_url":"https://api.github.com/repos/nette/database/commits{/sha}","git_commits_url":"https://api.github.com/repos/nette/database/git/commits{/sha}","comments_url":"https://api.github.com/repos/nette/database/comments{/number}","issue_comment_url":"https://api.github.com/repos/nette/database/issues/comments{/number}","contents_url":"https://api.github.com/repos/nette/database/contents/{+path}","compare_url":"https://api.github.com/repos/nette/database/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nette/database/merges","archive_url":"https://api.github.com/repos/nette/database/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nette/database/downloads","issues_url":"https://api.github.com/repos/nette/database/issues{/number}","pulls_url":"https://api.github.com/repos/nette/database/pulls{/number}","milestones_url":"https://api.github.com/repos/nette/database/milestones{/number}","notifications_url":"https://api.github.com/repos/nette/database/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nette/database/labels{/name}","releases_url":"https://api.github.com/repos/nette/database/releases{/id}","created_at":"2014-03-13T15:00:28Z","updated_at":"2015-12-08T14:07:26Z","pushed_at":"2015-12-08T18:29:59Z","git_url":"git://github.com/nette/database.git","ssh_url":"git@github.com:nette/database.git","clone_url":"https://github.com/nette/database.git","svn_url":"https://github.com/nette/database","homepage":"https://nette.org","size":1135,"stargazers_count":67,"watchers_count":67,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":26,"forks":52,"open_issues":26,"watchers":67,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nette/database/pulls/111"},"html":{"href":"https://github.com/nette/database/pull/111"},"issue":{"href":"https://api.github.com/repos/nette/database/issues/111"},"comments":{"href":"https://api.github.com/repos/nette/database/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/nette/database/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/nette/database/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nette/database/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/nette/database/statuses/440577dd91ae0e5ef8411797e8c9afadcca8c003"}}}}