{"action":"opened","issue":{"url":"https://api.github.com/repos/gocardless/gocardless-pro-php/issues/12","repository_url":"https://api.github.com/repos/gocardless/gocardless-pro-php","labels_url":"https://api.github.com/repos/gocardless/gocardless-pro-php/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/gocardless/gocardless-pro-php/issues/12/comments","events_url":"https://api.github.com/repos/gocardless/gocardless-pro-php/issues/12/events","html_url":"https://github.com/gocardless/gocardless-pro-php/issues/12","id":155819108,"number":12,"title":"Cannot retrieve array of mandates","user":{"login":"iWader","id":2007548,"avatar_url":"https://avatars.githubusercontent.com/u/2007548?v=3","gravatar_id":"","url":"https://api.github.com/users/iWader","html_url":"https://github.com/iWader","followers_url":"https://api.github.com/users/iWader/followers","following_url":"https://api.github.com/users/iWader/following{/other_user}","gists_url":"https://api.github.com/users/iWader/gists{/gist_id}","starred_url":"https://api.github.com/users/iWader/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iWader/subscriptions","organizations_url":"https://api.github.com/users/iWader/orgs","repos_url":"https://api.github.com/users/iWader/repos","events_url":"https://api.github.com/users/iWader/events{/privacy}","received_events_url":"https://api.github.com/users/iWader/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-19T19:45:26Z","updated_at":"2016-05-19T19:45:26Z","closed_at":null,"body":"Currently the paginator doesn't expose the `current_records()` function, nor does the mandate service provide a way to list mandates without using the paginator.\r\n\r\nLoops are great and all, but many people much prefer using collections, which enable much more fluent code, such as the following\r\n\r\n```php\r\n$callback = function(Mandate $mandate)\r\n{\r\n    return in_array($mandate->status, ['failed', 'cancelled', 'expired']);\r\n}\r\n\r\n$validMandates = collect($client->mandates()->list())->reject($callback);\r\n```\r\n\r\nCurrently you'd have to do something like this\r\n\r\n```php\r\n$mandates = $client->mandates()->list();\r\n$validMandates = [];\r\n\r\nforeach($mandates as $mandate)\r\n{\r\n    if (in_array($mandate->status, ['failed', 'cancelled', 'expired'])\r\n    {\r\n         $validMandates[] = $mandate;\r\n    }\r\n}\r\n```\r\n"}}