{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/10978","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/10978/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/10978/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/10978/events","html_url":"https://github.com/cakephp/cakephp/issues/10978","id":247294949,"number":10978,"title":"Query Builder orMatching needed","user":{"login":"hagen00","id":16573005,"avatar_url":"https://avatars2.githubusercontent.com/u/16573005?v=4","gravatar_id":"","url":"https://api.github.com/users/hagen00","html_url":"https://github.com/hagen00","followers_url":"https://api.github.com/users/hagen00/followers","following_url":"https://api.github.com/users/hagen00/following{/other_user}","gists_url":"https://api.github.com/users/hagen00/gists{/gist_id}","starred_url":"https://api.github.com/users/hagen00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hagen00/subscriptions","organizations_url":"https://api.github.com/users/hagen00/orgs","repos_url":"https://api.github.com/users/hagen00/repos","events_url":"https://api.github.com/users/hagen00/events{/privacy}","received_events_url":"https://api.github.com/users/hagen00/received_events","type":"User","site_admin":false},"labels":[{"id":60504544,"url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7","default":false},{"id":60504144,"url":"https://api.github.com/repos/cakephp/cakephp/labels/Enhancement","name":"Enhancement","color":"bfe5bf","default":false},{"id":60525626,"url":"https://api.github.com/repos/cakephp/cakephp/labels/On%20hold","name":"On hold","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-02T07:16:51Z","updated_at":"2017-08-02T07:17:34Z","closed_at":null,"body":"This is a (multiple allowed):\r\n\r\n* [x] bug\r\n* [x] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: CakePHP 3.4.12\r\n\r\n* Refers to: https://github.com/cakephp/cakephp/issues/5721#issuecomment-318170362\r\n* This is related: https://stackoverflow.com/questions/27288957/cakephp-3-0-multiple-matching-conditions\r\n\r\n### What you did\r\nThere are use cases where one would require the equivalent of orMatching(). Consider the following models: \r\narticles >-< tags (many to many)\r\narticles >-< categories (many to many)\r\n\r\nI would want to write a query that gets all articles that match tag \"foo\" OR category \"bar\". \r\n\r\n```\r\n$query = $this->Articles->find();\r\n\r\n$query->matching('Tags', function ($q) {\r\n\treturn $q->where(['Tags.title' => 'tag does not exist']);\r\n});\r\n\r\n// orMatching would be nice? I want to get all articles that match either a tag OR a category\t\t\r\n$query->matching('Categories', function ($q) {\r\n\treturn $q->where(['Categories.title' => 'category exists']);\r\n});\r\n\r\n// empty array is returned\r\ndebug($query->toArray());\r\n```\r\n\r\n### What happened\r\nIf one matching condition fails, then no data is returned. \r\n\r\n### What you expected to happen\r\n```\r\n// Something like this would be nice i.e. orMatching:\r\n$query->orMatching('Categories', function ($q) {\r\n\treturn $q->where(['Categories.title' => 'category exists']);\r\n});\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/319589160","html_url":"https://github.com/cakephp/cakephp/issues/10978#issuecomment-319589160","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/10978","id":319589160,"user":{"login":"VarCI-bot","id":17718013,"avatar_url":"https://avatars2.githubusercontent.com/u/17718013?v=4","gravatar_id":"","url":"https://api.github.com/users/VarCI-bot","html_url":"https://github.com/VarCI-bot","followers_url":"https://api.github.com/users/VarCI-bot/followers","following_url":"https://api.github.com/users/VarCI-bot/following{/other_user}","gists_url":"https://api.github.com/users/VarCI-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/VarCI-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VarCI-bot/subscriptions","organizations_url":"https://api.github.com/users/VarCI-bot/orgs","repos_url":"https://api.github.com/users/VarCI-bot/repos","events_url":"https://api.github.com/users/VarCI-bot/events{/privacy}","received_events_url":"https://api.github.com/users/VarCI-bot/received_events","type":"User","site_admin":false},"created_at":"2017-08-02T07:17:34Z","updated_at":"2017-08-02T07:17:34Z","body":"hagen00, please include the CakePHP version number you are using in your description. It helps us debug your issue.\n\n--\n_Automated response by [Var.CI](https://var.ci)_ :robot:"}}
{"actor":{"display_login":"VarCI-bot"}}