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

Ensure before / after events are executed independently #230

Merged
merged 2 commits into from
Oct 17, 2018

Conversation

adrians5j
Copy link
Member

These events must be executed outside save process.

This means that once the save starts, immediately execute beforeSave, beforeUpdate, beforeCreate events, and only then start the actual processing of entity. The same goes for "after" events, execute them once processing has been completely done.

This was done simply by renaming current before and after events to __before and __after, making them internal events, and inserting new ones that follow the explained behavior.

Motivation:
Eg. onAfterCreate developer again calls this.save(), this save call would not work. Entity was still in "processing" state, and method would immediately return.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 94.983% when pulling 53d8a7e on entity/afterSave into cbb94b0 on development.

@adrians5j adrians5j merged commit be7d731 into development Oct 17, 2018
@Pavel910 Pavel910 deleted the entity/afterSave branch October 20, 2018 18:38
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