Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEMRelationship conditional FEMMapping #78

Open
pavlonadolynskyi opened this issue Dec 19, 2016 · 3 comments
Open

FEMRelationship conditional FEMMapping #78

pavlonadolynskyi opened this issue Dec 19, 2016 · 3 comments

Comments

@pavlonadolynskyi
Copy link

pavlonadolynskyi commented Dec 19, 2016

Hi! I have a question about ability of FastEasyMapping to map relationship with different inner classes. I.e. I have a Questionnaire and it has 'questions' relation, but each question can be QuestionOpen or QuestionSelection, I can designate which class is that by 'type' property. @dimazen How can I achieve that?

@pavlonadolynskyi pavlonadolynskyi changed the title FEMMapping relationship for different classes FEMRelationship conditional FEMMapping Dec 19, 2016
@dimazen
Copy link
Contributor

dimazen commented Dec 20, 2016

Hello, @pablucco
It is kind of a dynamic mapping that can be found on RestKit. Unfortunately it is not implemented and therefore you won't be able to do so.

However I can take a look in the evening how much effort it'll take to implement it. It should be fairly simple to do.

@pavlonadolynskyi
Copy link
Author

pavlonadolynskyi commented Dec 20, 2016

@dimazen It would be so great! How are you planning to implement that? I mean will that cause architecture changes?

@dimazen
Copy link
Contributor

dimazen commented Dec 22, 2016

@pablucco hello there.I was digging into it and here are few thoughts:

  • we need to dynamically evaluate what mapping for the given JSON. The best way is to use blocks.
  • it is useful to add dynamic keyPath evaluation as well.

Most rough solution looks like adding block to the FEMMapping itself, that will evaluate given JSON and return FEMRelationship with correct values. I'm not quite sure, but it looks a little bit ugly to me. What do you think?

I mean will that cause architecture changes?

I don't think so. Probably we'll have few more methods on FEMMapping and some internal changes for FEMDeserializer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants