Skip to content

Skip implementing Related if the same related entity is being referenced by a conjunct relation#1298

Merged
billy1624 merged 1 commit intomasterfrom
fix-duplicated-related-impl
Dec 17, 2022
Merged

Skip implementing Related if the same related entity is being referenced by a conjunct relation#1298
billy1624 merged 1 commit intomasterfrom
fix-duplicated-related-impl

Conversation

@billy1624
Copy link
Copy Markdown
Member

@billy1624 billy1624 commented Dec 12, 2022

PR Info

Bug Fixes

The original bug description: #1287 (comment)

  • Skip implementing the direct Related if a many-to-many with intermediate entity exists.
// Skip implementation of ths
impl Related<super::baker::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Baker.def()
    }
}

// Keep this
impl Related<super::baker::Entity> for Entity {
    fn to() -> RelationDef {
        super::cakes_bakers::Relation::Baker.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::cakes_bakers::Relation::Cake.def().rev())
    }
}

@billy1624 billy1624 self-assigned this Dec 12, 2022
@billy1624 billy1624 marked this pull request as ready for review December 12, 2022 10:44
@billy1624 billy1624 requested a review from tyt2y3 December 12, 2022 10:44
@billy1624 billy1624 merged commit 8982d88 into master Dec 17, 2022
@billy1624 billy1624 deleted the fix-duplicated-related-impl branch December 17, 2022 04:52
billy1624 added a commit that referenced this pull request Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

> 0.10.2: error[E0119]: conflicting implementations of trait

1 participant