Skip to content
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

Merged
merged 9 commits into from
Jan 14, 2018
Merged

[5.6] Fix pivot serialization #22786

merged 9 commits into from
Jan 14, 2018

Conversation

taylorotwell
Copy link
Member

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.

@taylorotwell taylorotwell merged commit b52d314 into 5.6 Jan 14, 2018
@taylorotwell taylorotwell deleted the fix-pivot-serialization branch January 14, 2018 16:17
@GrahamCampbell GrahamCampbell changed the title Fix pivot serialization [5.6] Fix pivot serialization Jan 14, 2018

return $this->first() instanceof Pivot
? $this->map->getQueueableId()->all()
: $this->modelKeys();
Copy link
Contributor

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.
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants