{"action":"created","issue":{"url":"https://api.github.com/repos/api-platform/api-platform/issues/443","repository_url":"https://api.github.com/repos/api-platform/api-platform","labels_url":"https://api.github.com/repos/api-platform/api-platform/issues/443/labels{/name}","comments_url":"https://api.github.com/repos/api-platform/api-platform/issues/443/comments","events_url":"https://api.github.com/repos/api-platform/api-platform/issues/443/events","html_url":"https://github.com/api-platform/api-platform/issues/443","id":269100544,"number":443,"title":"MultiLevel InheritanceType not properly using Groups serialization for parent entities","user":{"login":"Julien-Marcou","id":4369075,"avatar_url":"https://avatars3.githubusercontent.com/u/4369075?v=4","gravatar_id":"","url":"https://api.github.com/users/Julien-Marcou","html_url":"https://github.com/Julien-Marcou","followers_url":"https://api.github.com/users/Julien-Marcou/followers","following_url":"https://api.github.com/users/Julien-Marcou/following{/other_user}","gists_url":"https://api.github.com/users/Julien-Marcou/gists{/gist_id}","starred_url":"https://api.github.com/users/Julien-Marcou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Julien-Marcou/subscriptions","organizations_url":"https://api.github.com/users/Julien-Marcou/orgs","repos_url":"https://api.github.com/users/Julien-Marcou/repos","events_url":"https://api.github.com/users/Julien-Marcou/events{/privacy}","received_events_url":"https://api.github.com/users/Julien-Marcou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-10-27T13:05:59Z","updated_at":"2017-10-27T14:30:30Z","closed_at":null,"author_association":"NONE","body":"Hello, I'm working on a dynamic Survey building engine, which allow you to define several type of Questions and several types of Answers, so I'm using InheritanceType to make it.\r\nThe base model looked like that :\r\n\r\nSurvey has many Questions\r\nQuestion has one Answer\r\nQuestion inheritance type mapping was [numeric=NumericQuestion, string=StringQuestion, enum=EnumQuestion...]\r\nAnswer inheritance type mapping was [numeric=NumericAnswer, string=StringAnswer, enum=EnumAnswer...]\r\n\r\nIt worked well with API Platform until I decided to add a new type of Question/Answer that extend from an already existing Question/Answer.\r\nThe new model now looks like this :\r\n\r\nSurvey has many Questions\r\nQuestion has one Answer\r\nQuestion inheritance type mapping is [numeric=NumericQuestion, string=StringQuestion, enum=EnumQuestion, string_attachment=StringWithAttachmentQuestion...]\r\nAnswer inheritance type mapping is [numeric=NumericAnswer, string=StringAnswer, enum=EnumAnswer, string_attachment=StringWithAttachmentAnswer...]\r\n\r\nObviously StringWithAttachmentQuestion/StringWithAttachmentAnswer extends StringQuestion/StringAnswer, but now API Platform is all broken for StringQuestion and StringAnswer routes.\r\n\r\nIt looks like that StringQuestion and StringAnswer are not using the normalization_context/denormalization_context ; so all fields are returned from GET queries and all fields are fillable with a POST query (instead of restricting them to those who are marked with the correct normalization_context/denormalization_context).\r\nEven more problematic, calling route for StringQuestion and StringAnswer also returns the fields of the StringWithAttachmentQuestion and StringWithAttachmentAnswer entities (with null values)."},"comment":{"url":"https://api.github.com/repos/api-platform/api-platform/issues/comments/339988013","html_url":"https://github.com/api-platform/api-platform/issues/443#issuecomment-339988013","issue_url":"https://api.github.com/repos/api-platform/api-platform/issues/443","id":339988013,"user":{"login":"soyuka","id":1321971,"avatar_url":"https://avatars3.githubusercontent.com/u/1321971?v=4","gravatar_id":"","url":"https://api.github.com/users/soyuka","html_url":"https://github.com/soyuka","followers_url":"https://api.github.com/users/soyuka/followers","following_url":"https://api.github.com/users/soyuka/following{/other_user}","gists_url":"https://api.github.com/users/soyuka/gists{/gist_id}","starred_url":"https://api.github.com/users/soyuka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soyuka/subscriptions","organizations_url":"https://api.github.com/users/soyuka/orgs","repos_url":"https://api.github.com/users/soyuka/repos","events_url":"https://api.github.com/users/soyuka/events{/privacy}","received_events_url":"https://api.github.com/users/soyuka/received_events","type":"User","site_admin":false},"created_at":"2017-10-27T14:30:30Z","updated_at":"2017-10-27T14:30:30Z","author_association":"MEMBER","body":"What kind of inheritance is that ? Inheritance is usually a bad idea by the way and yes we have some issues with doctrine inheritance but they mostly end up in \"wontfix\".\r\n\r\nBtw your first message is totally unreadable to me :laughing: From what I understood then, you should use a `type` column instead of using inheritance, there's no point here."}}
{"actor":{"display_login":"soyuka"}}