{"action":"created","issue":{"url":"https://api.github.com/repos/libgraviton/graviton/issues/181","labels_url":"https://api.github.com/repos/libgraviton/graviton/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/libgraviton/graviton/issues/181/comments","events_url":"https://api.github.com/repos/libgraviton/graviton/issues/181/events","html_url":"https://github.com/libgraviton/graviton/pull/181","id":94280552,"number":181,"title":"make PUT to behave like POST","user":{"login":"narcoticfresh","id":245441,"avatar_url":"https://avatars.githubusercontent.com/u/245441?v=3","gravatar_id":"","url":"https://api.github.com/users/narcoticfresh","html_url":"https://github.com/narcoticfresh","followers_url":"https://api.github.com/users/narcoticfresh/followers","following_url":"https://api.github.com/users/narcoticfresh/following{/other_user}","gists_url":"https://api.github.com/users/narcoticfresh/gists{/gist_id}","starred_url":"https://api.github.com/users/narcoticfresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narcoticfresh/subscriptions","organizations_url":"https://api.github.com/users/narcoticfresh/orgs","repos_url":"https://api.github.com/users/narcoticfresh/repos","events_url":"https://api.github.com/users/narcoticfresh/events{/privacy}","received_events_url":"https://api.github.com/users/narcoticfresh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-10T10:39:20Z","updated_at":"2015-07-12T07:39:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libgraviton/graviton/pulls/181","html_url":"https://github.com/libgraviton/graviton/pull/181","diff_url":"https://github.com/libgraviton/graviton/pull/181.diff","patch_url":"https://github.com/libgraviton/graviton/pull/181.patch"},"body":"as was noted by our customers, PUT now behaves different from POST (returning content instead of Location/Link header)..\r\n\r\nThis PR tries to make PUT behavior the same as POST. \r\n\r\nThis has some urgency, as (in a slightly unrelated matter) some services (as `Consultation`) fail to get there content back on the current PUT implementation is the Serializer struggles to deserialize what comes from Symfony form (ie some dates now seem to be String instead of DateTime)..\r\n\r\n@hairmare There seems mystery is happening in `FileControllerTest` (\"make array of things writable\"). Do you have any insight?  Somehow, when the `links` array is altered and PUT'ted, then GET'ted again, the `links` array has two items - which lead the test to fail.\r\n\r\nObviously, that test needs to pass - but I struggle to understand why the changes in `RestController` could render \"make array of things writable\" broken - any ideas?"},"comment":{"url":"https://api.github.com/repos/libgraviton/graviton/issues/comments/120698953","html_url":"https://github.com/libgraviton/graviton/pull/181#issuecomment-120698953","issue_url":"https://api.github.com/repos/libgraviton/graviton/issues/181","id":120698953,"user":{"login":"narcoticfresh","id":245441,"avatar_url":"https://avatars.githubusercontent.com/u/245441?v=3","gravatar_id":"","url":"https://api.github.com/users/narcoticfresh","html_url":"https://github.com/narcoticfresh","followers_url":"https://api.github.com/users/narcoticfresh/followers","following_url":"https://api.github.com/users/narcoticfresh/following{/other_user}","gists_url":"https://api.github.com/users/narcoticfresh/gists{/gist_id}","starred_url":"https://api.github.com/users/narcoticfresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narcoticfresh/subscriptions","organizations_url":"https://api.github.com/users/narcoticfresh/orgs","repos_url":"https://api.github.com/users/narcoticfresh/repos","events_url":"https://api.github.com/users/narcoticfresh/events{/privacy}","received_events_url":"https://api.github.com/users/narcoticfresh/received_events","type":"User","site_admin":false},"created_at":"2015-07-12T07:39:48Z","updated_at":"2015-07-12T07:39:48Z","body":"@hairmare I tried to dig in.. it seems that even though we have an empty `ArrayCollection` present in the `links` attribute we're trying to persist with OM; it doesn't get sent that way to MongoDB..\r\n\r\nSo we have this after `checkForm()` in `RestController`:\r\n\r\n```\r\nobject(GravitonDyn\\FileBundle\\Document\\File)[553]\r\n  protected 'id' => string '55a215884046a4792d8b4569' (length=24)\r\n  protected 'deletedDate' => null\r\n  protected 'links' => \r\n    object(Doctrine\\Common\\Collections\\ArrayCollection)[542]\r\n      private 'elements' => \r\n        array (size=0)\r\n          empty\r\n```\r\nAnd this is the query sent to Mongo (dev.log):\r\n```\r\n[2015-07-12 09:29:01] doctrine.DEBUG: MongoDB query: {\"update\":true,\"query\":{\"_id\":\"55a215884046a4792d8b4569\"},\"newObj\":{\"$set\":{\"metadata\":{\"_id\":\"55a2173d4046a4792d8b4573\",\"size\":\"4\",\"mime\":\"text\\/plain\",\"filename\":\"hans\"}}},\"options\":{\"upsert\":true},\"db\":\"db\",\"collection\":\"File\"} [] []\r\n```\r\n\r\nThere are 2 things that bug me:\r\n* ODM sends `upsert: true` to mongo - but `$upsert` in `RestController` is `false`\r\n* The `links` attribute is not set on query - and `upsert: true` leaves it there I guess..\r\n\r\nI really don't understand why Doctrine behaves that way.."}}