{"action":"created","issue":{"url":"https://api.github.com/repos/UseMuffin/Trash/issues/6","repository_url":"https://api.github.com/repos/UseMuffin/Trash","labels_url":"https://api.github.com/repos/UseMuffin/Trash/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/UseMuffin/Trash/issues/6/comments","events_url":"https://api.github.com/repos/UseMuffin/Trash/issues/6/events","html_url":"https://github.com/UseMuffin/Trash/pull/6","id":122472816,"number":6,"title":"Fix trash function to be compatible with CounterCacheBehavior","user":{"login":"adayth","id":1223929,"avatar_url":"https://avatars.githubusercontent.com/u/1223929?v=3","gravatar_id":"","url":"https://api.github.com/users/adayth","html_url":"https://github.com/adayth","followers_url":"https://api.github.com/users/adayth/followers","following_url":"https://api.github.com/users/adayth/following{/other_user}","gists_url":"https://api.github.com/users/adayth/gists{/gist_id}","starred_url":"https://api.github.com/users/adayth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adayth/subscriptions","organizations_url":"https://api.github.com/users/adayth/orgs","repos_url":"https://api.github.com/users/adayth/repos","events_url":"https://api.github.com/users/adayth/events{/privacy}","received_events_url":"https://api.github.com/users/adayth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-16T10:30:34Z","updated_at":"2016-04-25T06:52:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/UseMuffin/Trash/pulls/6","html_url":"https://github.com/UseMuffin/Trash/pull/6","diff_url":"https://github.com/UseMuffin/Trash/pull/6.diff","patch_url":"https://github.com/UseMuffin/Trash/pull/6.patch"},"body":"This PR allows to combine Trash and CounterCache behavior over the same fields.\r\n\r\nI detected while trying to use CounterCacheBehavior based in *deleted* trash field that when using *trash()* method counter caches are not updated, but *untrash()* method still updates counter caches.\r\n\r\nExample\r\n```php\r\n// Tasks has a deleted DATETIME NULLS ALLOWED DEFAULT NULL field\r\n\r\n// Tasks table initialize\r\n$this->addBehavior('Muffin/Trash.Trash');\r\n$this->addBehavior('CounterCache', [\r\n            'Clients' => [\r\n                'tasks_count_in_progress' => [\r\n                    'conditions' => ['Tasks.deleted IS' => null]\r\n                ],\r\n                'tasks_count_completed' => [\r\n                    'conditions' => ['Tasks.deleted IS NOT' => null]\r\n                ],\r\n            ],\r\n        ]);\r\n```"},"comment":{"url":"https://api.github.com/repos/UseMuffin/Trash/issues/comments/214165540","html_url":"https://github.com/UseMuffin/Trash/pull/6#issuecomment-214165540","issue_url":"https://api.github.com/repos/UseMuffin/Trash/issues/6","id":214165540,"user":{"login":"ADmad","id":142658,"avatar_url":"https://avatars.githubusercontent.com/u/142658?v=3","gravatar_id":"","url":"https://api.github.com/users/ADmad","html_url":"https://github.com/ADmad","followers_url":"https://api.github.com/users/ADmad/followers","following_url":"https://api.github.com/users/ADmad/following{/other_user}","gists_url":"https://api.github.com/users/ADmad/gists{/gist_id}","starred_url":"https://api.github.com/users/ADmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ADmad/subscriptions","organizations_url":"https://api.github.com/users/ADmad/orgs","repos_url":"https://api.github.com/users/ADmad/repos","events_url":"https://api.github.com/users/ADmad/events{/privacy}","received_events_url":"https://api.github.com/users/ADmad/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T06:52:01Z","updated_at":"2016-04-25T06:52:01Z","body":"@adayth Sorry for the very late response. Can you please provide a test case for the fix to avoid regression in future."}}