-
|
I’d like to propose a feature that would significantly improve the user experience when filtering records by related entities. In frameworks like Laravel, we often rely on
Core Proposal:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Love this idea! |
Beta Was this translation helpful? Give feedback.
-
|
I've added it in 87512c3 assert_eq!(
cake::Entity::find()
.has_related(fruit::Entity, fruit::Column::Name.eq("Mango"))
.build(DbBackend::Sqlite)
.to_string(),
[
r#"SELECT "cake"."id", "cake"."name" FROM "cake""#,
r#"WHERE EXISTS(SELECT 1 FROM "fruit""#,
r#"WHERE "fruit"."name" = 'Mango'"#,
r#"AND "cake"."id" = "fruit"."cake_id")"#,
]
.join(" ")
);
assert_eq!(
cake::Entity::find()
.has_related(filling::Entity, filling::Column::Name.eq("Marmalade"))
.build(DbBackend::Sqlite)
.to_string(),
[
r#"SELECT "cake"."id", "cake"."name" FROM "cake""#,
r#"WHERE EXISTS(SELECT 1 FROM "filling""#,
r#"INNER JOIN "cake_filling" ON "cake_filling"."filling_id" = "filling"."id""#,
r#"WHERE "filling"."name" = 'Marmalade'"#,
r#"AND "cake"."id" = "cake_filling"."cake_id")"#,
]
.join(" ")
); |
Beta Was this translation helpful? Give feedback.
I've added it in 87512c3