Resolve references when initializing Domain #419
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request moves resolving references, as well as validating domain constructs to domain initialization (
domain.init()
), not activation (domain.domain.context().push()
). This ensures they happen one time, at the beginning of domain setup. If they are in activation, the resolution would be triggered every time a domain context is activated, which would be every time the domain processes a request!This commit also has the following fixes:
setup_db
fixtures to Module level (Having them atsession
levelwas resulting in the wrong context being popped)
fetch_element_cls_from_registry
under Domain object to avoid usingcurrent_domain
domain
during class resolution to avoid usingcurrent_domain
meta_.aggregate_cls
)domain.init()
statements in tests