Use find_related in place of find_xxx
This commit is contained in:
parent
59322d37d8
commit
8f66968724
@ -68,4 +68,14 @@ impl Related<super::bakery::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Related<super::cake::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
super::cakes_bakers::Relation::Cake.def()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn via() -> Option<RelationDef> {
|
||||||
|
Some(super::cakes_bakers::Relation::Baker.def().rev())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -67,10 +67,4 @@ impl Related<super::baker::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
|
||||||
pub fn find_bakers(&self) -> Select<super::baker::Entity> {
|
|
||||||
Entity::find_related().belongs_to::<Entity>(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -98,10 +98,4 @@ impl Related<super::baker::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
|
||||||
pub fn find_bakers(&self) -> Select<super::baker::Entity> {
|
|
||||||
Entity::find_related().belongs_to::<Entity>(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -68,10 +68,4 @@ impl Related<super::order::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
|
||||||
pub fn find_orders(&self) -> Select<super::order::Entity> {
|
|
||||||
Entity::find_related().belongs_to::<Entity>(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -71,10 +71,4 @@ impl Related<super::order::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
|
||||||
pub fn find_orders(&self) -> Select<super::order::Entity> {
|
|
||||||
Entity::find_related().belongs_to::<Entity>(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -93,10 +93,4 @@ impl Related<super::lineitem::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Model {
|
|
||||||
pub fn find_lineitems(&self) -> Select<super::lineitem::Entity> {
|
|
||||||
Entity::find_related().belongs_to::<Entity>(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user