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

Additional ways of defining model relationships #120

Merged
merged 2 commits into from
Jul 8, 2022

Conversation

safo6m
Copy link
Member

@safo6m safo6m commented Jul 4, 2022

So far, propertyClass property of Attribute, HeaderAttribute, and HasOne decorators accepted classes only. This pull request introduces a new way of defining relationships by provided string identificators.
In order to use model's string identificator, the said identificator must be set on the model (modelType property), and the model must be provided in the list of models present in the DatastoreService (modelTypes property).

Why would you need to use string identificator instead of the exact class?
In case when two models have references between each other, the reference on one of the sides must be defined via string identificators to break the circular dependency.

https://github.com/infinum/ngx-hal/wiki/DefiningModelRelationships#circular-dependencies

@safo6m safo6m marked this pull request as ready for review July 8, 2022 15:02
@safo6m safo6m merged commit edf890c into master Jul 8, 2022
@safo6m safo6m deleted the flexible-relationships branch July 8, 2022 15:02
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

Successfully merging this pull request may close these issues.

1 participant