{"action":"created","issue":{"url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/183","labels_url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/183/comments","events_url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/183/events","html_url":"https://github.com/zfcampus/zf-apigility-doctrine/issues/183","id":74187008,"number":183,"title":"toMany in POST and PUT throwing unrecognizedIdentifierFields Exception","user":{"login":"nobesnickr","id":1879507,"avatar_url":"https://avatars.githubusercontent.com/u/1879507?v=3","gravatar_id":"","url":"https://api.github.com/users/nobesnickr","html_url":"https://github.com/nobesnickr","followers_url":"https://api.github.com/users/nobesnickr/followers","following_url":"https://api.github.com/users/nobesnickr/following{/other_user}","gists_url":"https://api.github.com/users/nobesnickr/gists{/gist_id}","starred_url":"https://api.github.com/users/nobesnickr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nobesnickr/subscriptions","organizations_url":"https://api.github.com/users/nobesnickr/orgs","repos_url":"https://api.github.com/users/nobesnickr/repos","events_url":"https://api.github.com/users/nobesnickr/events{/privacy}","received_events_url":"https://api.github.com/users/nobesnickr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-08T01:28:50Z","updated_at":"2015-05-08T23:21:14Z","closed_at":null,"body":"Greetings folks,\r\n\r\nI am seeing a weird issue that I'm not certain if is either a bug in this module, the DoctrineObject hydrator or something I am doing wrong / configured incorrectly. \r\n\r\nWhat I am trying to do is either a POST or PUT (both have same effect) with a collection for one of the fields. The goal is to handle adding/removing/updating the entities in the collection along with the parent entity (Adding/Removing handled by Hydration Strategies). \r\n\r\nMy specific use case is managing Phone Numbers for a Person.\r\n\r\nSo for example, my form POST's a JSON object such as:\r\n```\r\n{\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"phoneNumbers\": [\r\n        {\r\n            \"phoneNumber\": \"+14805551234\"\r\n        },\r\n        {\r\n            \"phoneNumber\": \"+14805557777\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nor PUT's a JSON object such as:\r\n```\r\n{\r\n    \"id\": 123,\r\n    \"firstName\": \"John\",\r\n    \"lastName\": \"Doe\",\r\n    \"phoneNumbers\": [\r\n        {\r\n            \"id\": 1,\r\n            \"phoneNumber\": \"+14805551234\"\r\n        },\r\n        {\r\n            \"id\": 2,\r\n            \"phoneNumber\": \"+14805557777\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\nMy input filter is setup to handle and validate the collection already but when the entity goes to hydrate the toMany association I get an error of: \r\n```\r\n{\r\n    \"file\": \"/vagrant/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php\",\r\n    \"line\": 411,\r\n    \"function\": \"unrecognizedIdentifierFields\",\r\n    \"class\": \"Doctrine\\\\ORM\\\\ORMException\",\r\n    \"type\": \"::\",\r\n    \"args\": [\r\n        \"MyAwesomeApp\\\\Entity\\\\PhoneNumber\",\r\n        [\r\n            \"phoneNumber\"\r\n        ]\r\n    ]\r\n}\r\n```\r\n\r\nI've already configured my entity to handle the collection on the add / remove methods for the collection but its never being called. The odd thing is, the concept works flawlessly when using Zend\\Form and a Collection Fieldset (I'm assuming because the fieldset returns an entity instead of an array).\r\n\r\nIf this is a bug, or enhancement or anything that requires work I'd be more than happy to handle it and push it up. If its not and anyone could point me in the right direction it would be most appreciated!"},"comment":{"url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/comments/100392568","html_url":"https://github.com/zfcampus/zf-apigility-doctrine/issues/183#issuecomment-100392568","issue_url":"https://api.github.com/repos/zfcampus/zf-apigility-doctrine/issues/183","id":100392568,"user":{"login":"nobesnickr","id":1879507,"avatar_url":"https://avatars.githubusercontent.com/u/1879507?v=3","gravatar_id":"","url":"https://api.github.com/users/nobesnickr","html_url":"https://github.com/nobesnickr","followers_url":"https://api.github.com/users/nobesnickr/followers","following_url":"https://api.github.com/users/nobesnickr/following{/other_user}","gists_url":"https://api.github.com/users/nobesnickr/gists{/gist_id}","starred_url":"https://api.github.com/users/nobesnickr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nobesnickr/subscriptions","organizations_url":"https://api.github.com/users/nobesnickr/orgs","repos_url":"https://api.github.com/users/nobesnickr/repos","events_url":"https://api.github.com/users/nobesnickr/events{/privacy}","received_events_url":"https://api.github.com/users/nobesnickr/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T23:21:14Z","updated_at":"2015-05-08T23:21:14Z","body":"Sounds good, I just pulled your branch so let me kick it around this weekend and I'll push up a PR when I have something tangible."}}