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.
Originally, you could only define associations within schema blocks. This is no longer needed due to automatic resolution of runtime objects, including schemas and their attributes. So now we can define associations anywhere, the most obvious place is a relation itself of course.
To make this possible I had to port
schema
andassociations
DSLs to the new component-based DSL. Backward-compatibility is maintained viarom/compat
.Bonus: improved plugins
This refactoring introduced additional challenge because of the way how schema DSL plugins worked. To make things better and easier to manage, plugins are now created per component with their own configurations. This is actually a pretty significant improvement because it allows you to write plugins for any component type and you have an isolated context with plugin's options and its target component configuration available to you.
This means that for example the customized Schema DSL in rom-sql can now be turned into a tiny plugin rather than having a full-blown Schema::DSL subclass and having to deal with it during setup.
Example