-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.6] Fix pivot serialization #22786
Conversation
…k into fix-pivot-serialization
|
||
return $this->first() instanceof Pivot | ||
? $this->map->getQueueableId()->all() | ||
: $this->modelKeys(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding getQueueableId()
to the Model
base class, and overriding it in Pivot
? Then you can always map to getQueueableId()
and get rid of the instanceof
. 😉
/** | ||
* Get the pivot columns for the relation. | ||
* | ||
* "pivot_" is prefixed ot each column for easy removal later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. "prefixed at", should be?
Currently, passing a custom pivot model to a queued job will cause errors when pulling the job back off the queue. This correct the storage of pivot model and morphed pivot model queueable IDs and also adjusts the restoration queries to use the new format.