spec(relations): manyToMany materialises the intermediate entity - #19
Open
delchev wants to merge 1 commit into
Open
spec(relations): manyToMany materialises the intermediate entity#19delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
An n:m has always been an intermediate (link) entity in this specification; the kind that named it was parsed and then materialised by nothing, which is the worst of the three possible states - a clean parse and a relationship that simply is not there. Specify the materialisation: `kind: manyToMany` writes the link entity <Declaring><Target> (or the relation's `through:`) with a generated key, a composition to the declaring side and a manyToOne to the target (cross-model allowed), and the authored relation becomes the navigation-only oneToMany to it - so the document holds exactly one representation of an n:m. The link is a real entity: table, detail grid with a dropdown, seedable, reportable. The explicit intermediate entity keeps its place, and gains a clear boundary: it is how a link that carries data of its own (a quantity, a partial amount, a valid-from) is authored. Also specified: one-sided declaration, which relation attributes travel to the link's target end and which are refused rather than ignored, the through:/name-collision rules, and the self-referencing case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
kind: manyToManywas parsed and materialised by nothing — a clean parse and a relationship that is simply absent from the generated application. This specifies the materialisation instead of the silent drop.An n:m has always been an intermediate (link) entity in this spec. Now the kind that names it writes that entity:
<Declaring><Target>— or the name given by the newthrough:attribute — with a generated integer key, acompositionto the declaring side and amanyToOneto the target (cross-model allowed viamodel:);oneToManyto the link, so the document holds exactly one representation of an n:m;The explicit intermediate entity keeps its place and gains a clear boundary: it is how a link that carries data of its own (a quantity, a partial amount, a valid-from date) is authored — then the
manyToManyis dropped.Also specified: declare an n:m on one side only; which relation attributes travel onto the link's target end (
where/show/major/size/leafOnly) and which are refused rather than ignored (composition,function,init,dependsOn, calculated actions,personal,partner);through:validity and the name-collision rule; the self-referencing case.Pages
docs/spec/relations.md— the Many-to-many section rewritten (materialised link + explicit intermediate entity).docs/reference.md— "Planned" entry replaced: what remains unimplemented is bridge fields on a generated link, not the kind itself;through:added to the attribute examples.