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

Entity / entities attributes - fixed save / delete behavior when set as dynamic #260

Merged
merged 2 commits into from
Oct 25, 2018

Conversation

adrians5j
Copy link
Member

@adrians5j adrians5j commented Oct 25, 2018

Normally in entity / entities attributes, certain save / delete processes must occur once the main entity is being saved / deleted. This is because links need to be validated and properly managed.

But, if entity / entities attributes are marked as dynamic, value is always returned by provided callback, eg.:

this.attr("revisions")
                .entities(Page)
                .setDynamic(() => {
                    return Page.find({ query: { parent: this.parent }, sort: { version: -1 } });
                });

Also, these cannot have value assigned.

So in these cases, when entity / entities attributes are dynamic, mentioned save / deleted processes must not occur at all.

@adrians5j adrians5j self-assigned this Oct 25, 2018
@adrians5j adrians5j merged commit c4741a0 into development Oct 25, 2018
@adrians5j adrians5j deleted the entity/dynamicEntityDeleteFix branch October 25, 2018 16:55
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 94.961% when pulling 1e1d49f on entity/dynamicEntityDeleteFix into b9f51bb on development.

Pavel910 pushed a commit that referenced this pull request Oct 31, 2018
… save / delete processing (#260)

Check PR for additional info.
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.

2 participants