-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Fix] embed relations serialization #3410
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
[Fix] embed relations serialization #3410
Conversation
Hello,
Why Coding Standards / phpcs (pull_request)
Fail ?
In order to review the PR properly, could you add some tests that are fixed by the change?
Why Coding Standards / phpcs (pull_request) Fail?
GitHub Action fails to commit the fixes that are found by phpcs.
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
src/Eloquent/EmbedsRelations.php 2 0
src/Eloquent/DocumentModel.php 1 0
----------------------------------------------------------------------
A TOTAL OF 3 ERRORS WERE FIXED IN 2 FILES
----------------------------------------------------------------------
Yes of course, I will write the tests in the next few days
For CI errors, can I do something?
For CI errors, can I do something?
You can run vendor/bin/phpcbf
locally to fix the CS issues.
Thanks, Done! I'll write the tests when I have some time...
Adding test ok
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.
It seems to me that this is more of a documentation issue that something we should fix in the code.
As for any relationship, if you want to load the data from an embedded relationship you have to use the Model::$with
property or call Builder::with()
.
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.
In order to get the address
property correctly casted, you must call with('address')
:
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.
Having this new configuration to "fix" the bugged behavior of the embed relationship seems wrong.
The default $with
property can be leveraged:
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.
This new method is not used and not tested. It doesn't seems to be part of the fix.
Uh oh!
There was an error while loading. Please reload this page.
Fixed the serialization of embed relations.
These relationships were not necessarily loaded, and could not use their attribute mutators.
Checklist