{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/6102","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/6102/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/6102/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/6102/events","html_url":"https://github.com/cakephp/cakephp/issues/6102","id":62918375,"number":6102,"title":"Implement `Query::notMatching()`","user":{"login":"lorenzo","id":37621,"avatar_url":"https://avatars.githubusercontent.com/u/37621?v=3","gravatar_id":"","url":"https://api.github.com/users/lorenzo","html_url":"https://github.com/lorenzo","followers_url":"https://api.github.com/users/lorenzo/followers","following_url":"https://api.github.com/users/lorenzo/following{/other_user}","gists_url":"https://api.github.com/users/lorenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/lorenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorenzo/subscriptions","organizations_url":"https://api.github.com/users/lorenzo/orgs","repos_url":"https://api.github.com/users/lorenzo/repos","events_url":"https://api.github.com/users/lorenzo/events{/privacy}","received_events_url":"https://api.github.com/users/lorenzo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/ORM","name":"ORM","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/31","html_url":"https://github.com/cakephp/cakephp/milestones/3.1.0","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/31/labels","id":919718,"number":31,"title":"3.1.0","description":"Backwards compatible with 3.0.x. Will require PHP 5.5\r\n\r\n### Specific issues\r\n\r\n* Adding the exception trace to the error view data. #6000 \r\n* Changed the translate behavior to support translation engines. #5958 \r\n* Database connection prefixes, or table prefixes.","creator":{"login":"lorenzo","id":37621,"avatar_url":"https://avatars.githubusercontent.com/u/37621?v=3","gravatar_id":"","url":"https://api.github.com/users/lorenzo","html_url":"https://github.com/lorenzo","followers_url":"https://api.github.com/users/lorenzo/followers","following_url":"https://api.github.com/users/lorenzo/following{/other_user}","gists_url":"https://api.github.com/users/lorenzo/gists{/gist_id}","starred_url":"https://api.github.com/users/lorenzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorenzo/subscriptions","organizations_url":"https://api.github.com/users/lorenzo/orgs","repos_url":"https://api.github.com/users/lorenzo/repos","events_url":"https://api.github.com/users/lorenzo/events{/privacy}","received_events_url":"https://api.github.com/users/lorenzo/received_events","type":"User","site_admin":false},"open_issues":40,"closed_issues":5,"state":"open","created_at":"2015-01-02T15:38:07Z","updated_at":"2015-03-19T08:39:16Z","due_on":"2015-06-30T04:00:00Z","closed_at":null},"comments":0,"created_at":"2015-03-19T08:39:16Z","updated_at":"2015-03-19T08:39:16Z","closed_at":null,"body":"Filtering rows when that don't match an association is a common requirement, but is not something most people is confortable with coding themselves in SQL.\r\n\r\nOffering a `Query::notMatching($association, $queryBuilder)` would be a nice addition to the ORM. It can be implemented using 2 strategies:\r\n\r\n* Doing a LEFT JOIN on the target association and adding a WHERE target.primary_key is NULL\r\n* Using a WHERE NOT EXISTS subquery\r\n\r\nIn general the first approach is more performant, but it cannot be applied in all situations, specially when the same association is added to `contain()`"}}