{"action":"created","issue":{"url":"https://api.github.com/repos/doctrine/data-fixtures/issues/167","labels_url":"https://api.github.com/repos/doctrine/data-fixtures/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/doctrine/data-fixtures/issues/167/comments","events_url":"https://api.github.com/repos/doctrine/data-fixtures/issues/167/events","html_url":"https://github.com/doctrine/data-fixtures/pull/167","id":54052062,"number":167,"title":"Fix composite key serialization","user":{"login":"ddeboer","id":89267,"avatar_url":"https://avatars.githubusercontent.com/u/89267?v=3","gravatar_id":"","url":"https://api.github.com/users/ddeboer","html_url":"https://github.com/ddeboer","followers_url":"https://api.github.com/users/ddeboer/followers","following_url":"https://api.github.com/users/ddeboer/following{/other_user}","gists_url":"https://api.github.com/users/ddeboer/gists{/gist_id}","starred_url":"https://api.github.com/users/ddeboer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddeboer/subscriptions","organizations_url":"https://api.github.com/users/ddeboer/orgs","repos_url":"https://api.github.com/users/ddeboer/repos","events_url":"https://api.github.com/users/ddeboer/events{/privacy}","received_events_url":"https://api.github.com/users/ddeboer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/doctrine/data-fixtures/labels/Improvement","name":"Improvement","color":"009800"},{"url":"https://api.github.com/repos/doctrine/data-fixtures/labels/Needs%20tests","name":"Needs tests","color":"fef2c0"},{"url":"https://api.github.com/repos/doctrine/data-fixtures/labels/Needs%20work","name":"Needs work","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/doctrine/data-fixtures/milestones/3","html_url":"https://github.com/doctrine/data-fixtures/milestones/1.1","labels_url":"https://api.github.com/repos/doctrine/data-fixtures/milestones/3/labels","id":1032970,"number":3,"title":"1.1","description":"","creator":{"login":"lavoiesl","id":1216046,"avatar_url":"https://avatars.githubusercontent.com/u/1216046?v=3","gravatar_id":"","url":"https://api.github.com/users/lavoiesl","html_url":"https://github.com/lavoiesl","followers_url":"https://api.github.com/users/lavoiesl/followers","following_url":"https://api.github.com/users/lavoiesl/following{/other_user}","gists_url":"https://api.github.com/users/lavoiesl/gists{/gist_id}","starred_url":"https://api.github.com/users/lavoiesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavoiesl/subscriptions","organizations_url":"https://api.github.com/users/lavoiesl/orgs","repos_url":"https://api.github.com/users/lavoiesl/repos","events_url":"https://api.github.com/users/lavoiesl/events{/privacy}","received_events_url":"https://api.github.com/users/lavoiesl/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":3,"state":"open","created_at":"2015-03-22T20:21:04Z","updated_at":"2015-03-23T01:34:29Z","due_on":"2015-03-26T04:00:00Z","closed_at":null},"comments":4,"created_at":"2015-01-12T13:15:57Z","updated_at":"2015-03-25T20:41:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/doctrine/data-fixtures/pulls/167","html_url":"https://github.com/doctrine/data-fixtures/pull/167","diff_url":"https://github.com/doctrine/data-fixtures/pull/167.diff","patch_url":"https://github.com/doctrine/data-fixtures/pull/167.patch"},"body":"Currently, calling `unserialize()` with some data previously returned from `serialize()` produces:\r\n\r\n```php\r\nArray to string conversion\r\n\r\n/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2913\r\n```\r\n\r\nThis is caused by `serialize()` incorrectly serializing entities with primary keys (on doctrine/orm 2.4.):\r\n\r\n```php\r\n\"ref1\":[\"Entity\\\\MyEntity\",{\"user\":{\"__initializer__\":{},\"__cloner__\":{},\"__isInitialized__\":false},\"somethingElse\":{\"__initializer__\":null,\"__cloner__\":null,\"__isInitialized__\":true}}]\r\n```\r\n\r\nThis seems to be caused by the identifier lookup for `$simpleReferences` not working properly. For each object constituting the composite key, it returns the object itself instead of its id. E.g.:\r\n\r\n```php\r\narray(2) {\r\n  [0] =>\r\n  string(38) \"Entity\\MyEntity\"\r\n  [1] => \r\n    'user' =>\r\n    class Proxies\\__CG__\\Entity\\User#4711 (25) {\r\n        // ...\r\n    },\r\n    'somethingElse' =>\r\n    class Proxies\\__CG__\\Entity\\SomethingElse#1234 (25) {\r\n        // ...\r\n    }\r\n```\r\n\r\nBy adding a `getReference()` the identifier lookup works correctly. It now looks at `$this->identities` first, which holds the correct composite identities. Of course, the extra call does have a slight performance impact:\r\n\r\n```php\r\narray(2) {\r\n  [0] =>\r\n  string(38) \"Entity\\MyEntity\"\r\n  [1] =>\r\n  array(3) {\r\n    'user' =>\r\n    int(4)\r\n    'somethingElse' =>\r\n    int(1)\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/doctrine/data-fixtures/issues/comments/86207734","html_url":"https://github.com/doctrine/data-fixtures/pull/167#issuecomment-86207734","issue_url":"https://api.github.com/repos/doctrine/data-fixtures/issues/167","id":86207734,"user":{"login":"lavoiesl","id":1216046,"avatar_url":"https://avatars.githubusercontent.com/u/1216046?v=3","gravatar_id":"","url":"https://api.github.com/users/lavoiesl","html_url":"https://github.com/lavoiesl","followers_url":"https://api.github.com/users/lavoiesl/followers","following_url":"https://api.github.com/users/lavoiesl/following{/other_user}","gists_url":"https://api.github.com/users/lavoiesl/gists{/gist_id}","starred_url":"https://api.github.com/users/lavoiesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavoiesl/subscriptions","organizations_url":"https://api.github.com/users/lavoiesl/orgs","repos_url":"https://api.github.com/users/lavoiesl/repos","events_url":"https://api.github.com/users/lavoiesl/events{/privacy}","received_events_url":"https://api.github.com/users/lavoiesl/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T20:41:37Z","updated_at":"2015-03-25T20:41:37Z","body":"@ddeboer, I would like to be able to release this PR in 1.1 by tomorrow, do you think you would be able to care of it?"}}