Join Aliases And Serlialised Models #4182
Unanswered
the-mediocre-dev
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Lucid does not alias joins by default, which can lead to strange / erroneous serialization when joining through a model.
I have created a repo to highlight the issue. Check the test.
The join here produces the following SQL
the results of which, as there is no aliasing or explicit selecting, will have multiple
id
columns.While the SQL is sane, the issue arises when the result set is serialised into the
Issue
model. As there are two comments, we end up with two issues, each having theid
of one of the comments.Having a look at a dump of a sample test run, you can see it seems the issue is being serialized from the comment ids.
Is this a bug, or am I using Lucid wrong and this is the expected behaviour?
Beta Was this translation helpful? Give feedback.
All reactions