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

Fix nested create, upsert and update on lists of inputs #1316

Merged
merged 22 commits into from
Apr 23, 2020

Conversation

megawubs
Copy link
Contributor

@megawubs megawubs commented Apr 23, 2020

  • Added or updated tests
  • Added Docs for all relevant versions
  • Updated CHANGELOG.md

Resolves #1315

Changes

Pass a new instance of the model to the actual update method.

Breaking changes
None

@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

@megawubs the branch was quite out of date. There is a GitHub bot which automatically keeps your forks up to date: https://probot.github.io/apps/pull/ (Beware that it nukes any changes you made on the master branch of any fork)

…-input' into fix-create-upsert-update-list-of-input

# Conflicts:
#	CHANGELOG.md
@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

Concerning 26a9406, we can not change that until we drop support for PHPUnit 6.

@megawubs
Copy link
Contributor Author

@spawnia does this need an update on the docs?

@megawubs
Copy link
Contributor Author

megawubs commented Apr 23, 2020

Concerning 26a9406, we can not change that until we drop support for PHPUnit 6.

Ah ok, i'll revert that then

Did you already revert it?

@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

@spawnia does this need an update on the docs?

We actually have an example in the docs that is now fixed:

input CreateTaskInput {
  name: String!
  notes: [CreateNoteInput!] @create
}

@megawubs
Copy link
Contributor Author

@megawubs the branch was quite out of date. There is a GitHub bot which automatically keeps your forks up to date: https://probot.github.io/apps/pull/ (Beware that it nukes any changes you made on the master branch of any fork)

🤔 I did a merge with upstream before I started. Never mind, looks like it still contains the fix.

@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

I did a merge with upstream before I started. Never mind, looks like it still contains the fix.

AFAIK, doing that in PHPStorm does not automatically pull upstream?

@megawubs
Copy link
Contributor Author

I think this is everything right?

@megawubs
Copy link
Contributor Author

I did a merge with upstream before I started. Never mind, looks like it still contains the fix.

AFAIK, doing that in PHPStorm does not automatically pull upstream?

Did it through command line git.

@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

I think this is everything right?

Yeah, great job! Thanks a lot for taking the time to write proper tests. I am going to release a new version right now.

@spawnia spawnia changed the title Fix create upsert update list of input Fix nested create, upsert and update on lists of inputs Apr 23, 2020
@spawnia spawnia merged commit f8a2bea into nuwave:master Apr 23, 2020
@megawubs megawubs deleted the fix-create-upsert-update-list-of-input branch April 23, 2020 06:53
@lorado
Copy link
Collaborator

lorado commented Apr 23, 2020

Did I miss something? I thought there is no need to use @create/@update on nested mutations.

input CreateUserInput {
    name: String
    tasks: [CreateTaskInput!] @create
}

It still works also without @create on tasks field, right? I don't understand the use case.

@spawnia
Copy link
Collaborator

spawnia commented Apr 23, 2020

@lorado without @create, you would have to add an intermediary input like this:

input CreateUserInput {
    name: String
    tasks: [CreateTaskHasMany!]
}

input CreateTaskHasMany {
    create: [CreateTaskInput!]
}

You can skip that layer if you know that all you are ever going to do with that relation is specifically create.

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.

Using @upsert or @update on an array of input types gives unexpected behavior
3 participants