-
Let's say I have a Each child has a field with its parent's id. Now I can select all good_children for some parent with let (parent, good_children) = model::parent::Entity::find_by_id(42)
.find_with_related(model::good_child::Entity)
.all(&db.begin().await.map_err(…)?)
.await
.map_err(…)?
.pop()
.ok_or(…)?; But how can I get the neutral and chaotic children in the same query? Simply adding another
I asked the same question on stackoverflow, too: Multiple |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Hey @Kijewski, sorry for the delay. Currently we only support one |
Beta Was this translation helpful? Give feedback.
-
@billy1624 is this feature added ? |
Beta Was this translation helpful? Give feedback.
-
Any update on this? Is this feature coming in the future? |
Beta Was this translation helpful? Give feedback.
-
Not only does find_also_related need to be called multiple times, but find_with_related, find_also_linked, and find_with_linked should also be able to be called multiple times. I don’t quite understand why the default design was set to relate to only one table in the query. If it can relate to one, why can’t it relate to multiple? It’s so strange. A typical query usually involves joining several tables, but the current functionality is difficult to use. |
Beta Was this translation helpful? Give feedback.
Hey @Kijewski, sorry for the delay. Currently we only support one
*_related
at a time. So, I'd suggest you to create a custom struct to hold the query result of each row consist of good_child, neutral_child and chaotic_child data. See https://www.sea-ql.org/SeaORM/docs/advanced-query/custom-select/#handling-custom-selects for details.