[8.x] Add morph type to attributes when making new pivot #36640
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when attaching a morph pivot the
type
will be set on the new pivot record as it's done within the overloadedbaseAttachRecord
method.When making a new pivot it's handy to set the morph type as the pivot is ambiguous without it. My main use case is a
deleting
event on my custom morph pivot model. This event at the moment will only get the IDs for the pivot but not the morph type, so I don't exactly know what is being deleted.If there's potentially problems elsewhere with setting this here then that's fine, it can be worked around for my cases, I just figured it'd be nice to get this in upstream.
Cheers.