{"action":"created","issue":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/2978","repository_url":"https://api.github.com/repos/keystonejs/keystone","labels_url":"https://api.github.com/repos/keystonejs/keystone/issues/2978/labels{/name}","comments_url":"https://api.github.com/repos/keystonejs/keystone/issues/2978/comments","events_url":"https://api.github.com/repos/keystonejs/keystone/issues/2978/events","html_url":"https://github.com/keystonejs/keystone/issues/2978","id":157626238,"number":2978,"title":"Relationships and Polymorphism (Inherits functionality too limited)","user":{"login":"feedyourmind","id":19272440,"avatar_url":"https://avatars.githubusercontent.com/u/19272440?v=3","gravatar_id":"","url":"https://api.github.com/users/feedyourmind","html_url":"https://github.com/feedyourmind","followers_url":"https://api.github.com/users/feedyourmind/followers","following_url":"https://api.github.com/users/feedyourmind/following{/other_user}","gists_url":"https://api.github.com/users/feedyourmind/gists{/gist_id}","starred_url":"https://api.github.com/users/feedyourmind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedyourmind/subscriptions","organizations_url":"https://api.github.com/users/feedyourmind/orgs","repos_url":"https://api.github.com/users/feedyourmind/repos","events_url":"https://api.github.com/users/feedyourmind/events{/privacy}","received_events_url":"https://api.github.com/users/feedyourmind/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-31T09:21:15Z","updated_at":"2016-05-31T15:42:35Z","closed_at":"2016-05-31T15:19:59Z","body":"I have a model like this:\r\nlist x - field relationship to p (parent)\r\np can be C1, C2 or C3 .. (for child1, 2 and 3)\r\nin the admin ui, when I navigate from x to the p, it loads the fields of only the parent, instead of bringing up the right child (c1, 2 or 3) . \r\nThis defies the whole point of modelling relationships with polymorphism.\r\n\r\nTo get around it, I had to model the whole thing differently:\r\nI put the relationship field on the P like this:\r\nP -> many X\r\n\r\nand then on the X side, I added a relationship declaration for each child type:\r\nX.relationship(..., ref:'C1')\r\nX.relationship(..., ref:'C2')\r\nX.relationship(..., ref:'C3')\r\n\r\nAt least this way, now I can navigate from X to the right P model. \r\nBut this sucks:\r\n- it is unnatural\r\n- allows for invalid state of a X-P many-to-many when the intention was for it to be X-P Many-To-One\r\n- it makes building the view with mongoose queries more challenging, because I can not use populate(....\r\n- For every new Child of P a new relationship declaration is needed on the side of X\r\n\r\nI guess, since I could do it using this workaround, a few changes could be done in the code to make it load the right child when the owner of the relationship is the other object (x in the example)\r\n\r\nThis is important, otherwise, it's really a very small benefit of using inheritance in the first place"},"comment":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/comments/222729594","html_url":"https://github.com/keystonejs/keystone/issues/2978#issuecomment-222729594","issue_url":"https://api.github.com/repos/keystonejs/keystone/issues/2978","id":222729594,"user":{"login":"feedyourmind","id":19272440,"avatar_url":"https://avatars.githubusercontent.com/u/19272440?v=3","gravatar_id":"","url":"https://api.github.com/users/feedyourmind","html_url":"https://github.com/feedyourmind","followers_url":"https://api.github.com/users/feedyourmind/followers","following_url":"https://api.github.com/users/feedyourmind/following{/other_user}","gists_url":"https://api.github.com/users/feedyourmind/gists{/gist_id}","starred_url":"https://api.github.com/users/feedyourmind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedyourmind/subscriptions","organizations_url":"https://api.github.com/users/feedyourmind/orgs","repos_url":"https://api.github.com/users/feedyourmind/repos","events_url":"https://api.github.com/users/feedyourmind/events{/privacy}","received_events_url":"https://api.github.com/users/feedyourmind/received_events","type":"User","site_admin":false},"created_at":"2016-05-31T15:42:35Z","updated_at":"2016-05-31T15:42:35Z","body":"initially I added a comment in that ticket, but then I thought it's not really exactly the same.\r\n\r\nfrom my perspective the thing I'm most interested in is for a way to navigate from one list to another, so, when displaying relationship information, I just needed to display links to the children as well as the parents. \r\n\r\nthe way I interpreted ticket #2321 is as a more fundamental change , which will load the child list when specific id is requested. \r\nAnyway, I'll add my thoughts as a comment again, although I think what I'm talking about would be easier to implement and it would add huge value to people who use inheritance and collections until the other change is implemented. \r\n"}}
{"actor":{"display_login":"feedyourmind"}}