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

Allow relationships to have an alternative key if relationship key not exist #12

Closed
danivek opened this issue Oct 24, 2016 · 0 comments
Closed
Assignees

Comments

@danivek
Copy link
Owner

danivek commented Oct 24, 2016

Some ORM (like js-data) have two keys in object for defining a relation :

  • a key with id or ids (unpopulated relation)
  • a key with a populated relation

example for an article with a relation with a user :

{
  "id": "1",
  "title": "Nice article",
  "user_id": "2", // unpopulated user
  "user": { // populated user
    "id": "2",
    "name": "John Doe"
  }
}

If we not explicitly populate relation in the ORM, we only have the user_id key in object.

So, relationships configuration could have an alternative key to watch for unpopulated relationships if the populate relationship key does not exist.

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

No branches or pull requests

1 participant