Skip to content

[5.6] Fix pivot serialization#22786

Merged
taylorotwell merged 9 commits into
5.6from
fix-pivot-serialization
Jan 14, 2018
Merged

[5.6] Fix pivot serialization#22786
taylorotwell merged 9 commits into
5.6from
fix-pivot-serialization

Conversation

@taylorotwell

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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