Replies: 2 comments 1 reply
-
In principal at last, this actually sounds like a genuine bug - is it worth creating a Github issue for it? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I've suggested a possible solution here: #48432 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you have a MorphPivot entity with a custom class, when attaching a record, you get the pivot with all the fields loaded on the model, but if you detach it, you only get the IDs of both sides, so in case of morphPivots, you do not get the type/class of the entity so there's information missing and you cannot obtain the morph relation from the pivot because it throws an error.
This can be fixed by referring to the pivotParent attribute on the MorphPivot but it's kind of weird as in the attach process you can refer to the relation. My solution is using the pivotParent attribute on both attach and detach events so we behave the same way in both situations.
Beta Was this translation helpful? Give feedback.
All reactions