{"action":"opened","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/7643","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/7643/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7643/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/7643/events","html_url":"https://github.com/cakephp/cakephp/issues/7643","id":115040794,"number":7643,"title":"Entity::toArray() does not convert objects to array","user":{"login":"waltervos","id":30372,"avatar_url":"https://avatars.githubusercontent.com/u/30372?v=3","gravatar_id":"","url":"https://api.github.com/users/waltervos","html_url":"https://github.com/waltervos","followers_url":"https://api.github.com/users/waltervos/followers","following_url":"https://api.github.com/users/waltervos/following{/other_user}","gists_url":"https://api.github.com/users/waltervos/gists{/gist_id}","starred_url":"https://api.github.com/users/waltervos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waltervos/subscriptions","organizations_url":"https://api.github.com/users/waltervos/orgs","repos_url":"https://api.github.com/users/waltervos/repos","events_url":"https://api.github.com/users/waltervos/events{/privacy}","received_events_url":"https://api.github.com/users/waltervos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-04T12:20:11Z","updated_at":"2015-11-04T12:20:11Z","closed_at":null,"body":"I ran into this issue as I was trying to convert a query result to a collection (`new Collection($result->toArray())`) and then trying to `Collection::extract()`. When I follow that with a `Collection::toList()` or `Collection::toArray()` call, I get the following error:\r\n\r\n> Cannot use object of type Cake\\I18n\\Time as array in (..)/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php on line 84\r\n\r\nAs far as I can see, this is because of `Cake\\I18n\\Time` objects present in the collection. These don't get converted to an array in `Entity::toArray()`.\r\n\r\nI hope this is just my failure to grasp the workings of collections fully ;), but otherwise I think we should make sure that other objects get converted to array values as well."}}