-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update push
and pull
docs
#2685
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
18701c9
Update push documentation;
hans-thomas 36323f3
WIP
hans-thomas 7fd5a6a
Update pull documentation;
hans-thomas 19330c5
WIP
hans-thomas 9ba44df
WIP
hans-thomas d47380c
WIP
hans-thomas ac3d9ab
Notice added for value arrays;
hans-thomas 010663f
Update push docs;
hans-thomas c2bd491
Update pull docs;
hans-thomas 7cb4def
Fix the JS syntax;
hans-thomas 982d724
Update docs;
hans-thomas 509b009
Update query-builder.md
hans-thomas a55fc86
Merge branch '4.1' into 2387-update-docs
GromNaN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
I haven't checked the code, but this suggests that the boolean causes
$addToSet
to be used internally instead of$push
. Is that correct?Having a boolean argument control that rubs me the wrong way (I'll add it to the growing list), but I assume there's an explanation for this behavior. Is the
push()
method here actually derived from something else in Eloquent, or was it originally created in this library specifically for the MQL operators?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.
Yes. It's the logged queries of pushing normally and pushing unique values.
The
push
method is originally from Eloquent and it's used for saving a model instance and its relationships to the database. this library overrides thepush
method and accepts three args. If no arg is passed, the originalpush
method will be called.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.
Is Eloquent's
push
method documented anywhere beyond Recursively Saving Models & Relationships? That doesn't appear to take any arguments and the method seems entirely different in purpose (this doesn't have to do with relationships).@GromNaN: A boolean flag to determine whether
$push
or$addToSet
is used seems like a poor design as it makes the code less self-documenting. I think this is compounded by the fact that the method on the model class usesfunc_get_args()
and doesn't define a named parameter that users could specify if they so desired.It may be worth making a ticket to revisit this down the line. Perhaps introduce a new
addToSet()
method and then deprecate the original variation. This might also be a moot point when/if the query builder is integrated.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.
💯 agree that the double behavior of this method is a bad design.
If deprecate the custom behavior of
Model::push
with parameters, we have to do deprecate thepull
method too.Let's improve the documentation for now.