Skip to content

[5.6] Remove attribute filling from pivot model#23401

Merged
taylorotwell merged 2 commits intolaravel:5.6from
staudenmeir:5.6
Mar 6, 2018
Merged

[5.6] Remove attribute filling from pivot model#23401
taylorotwell merged 2 commits intolaravel:5.6from
staudenmeir:5.6

Conversation

@staudenmeir
Copy link
Copy Markdown
Contributor

When querying a pivot relationship with a specified model (using()) the attributes are set using forceFill(), causing custom mutators to be called.

This is inconsistent with non-pivot models and also unnecessary, since the values are immediately overwritten with the raw attributes.

Fixes #23234.

@jmarcher
Copy link
Copy Markdown
Contributor

jmarcher commented Mar 6, 2018

Do not change the tests, add new tests instead.

@staudenmeir
Copy link
Copy Markdown
Contributor Author

I replaced the test because it didn't seem to test double mutation, since there aren't any mutators in the model stub.

Also, having tests called testFromRawAttributesDoesNotDoubleMutate and testFromRawAttributesDoesNotMutate makes little sense.

@taylorotwell taylorotwell merged commit 8bfcf52 into laravel:5.6 Mar 6, 2018
@sylvain-gaffie-sociomantic
Copy link
Copy Markdown
Contributor

Hi,

Any chance this could be merged into 5.5?
Migrating to 5.6 requires php 7.1+.

I am not sure about how you guys handle previous versions...
Thank you.

taylorotwell pushed a commit that referenced this pull request Mar 15, 2018
* Remove attribute filling from pivot model

* Re-add test
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.

5 participants