bug #10544: create new resource on update if not found#102
Open
dimaip wants to merge 1 commit intoSylius:1.10from
Open
bug #10544: create new resource on update if not found#102dimaip wants to merge 1 commit intoSylius:1.10from
dimaip wants to merge 1 commit intoSylius:1.10from
Conversation
vvasiloi
reviewed
Aug 15, 2019
|
|
||
| $this->isGrantedOr403($configuration, ResourceActions::UPDATE); | ||
| $resource = $this->findOr404($configuration); | ||
| $resource = $this->findOrCreate($configuration); |
Contributor
There was a problem hiding this comment.
It should probably be conditional, since it's only for PUT requests, the PATCH should return 404 if the resource does not exists.
if ($request->isMethod(Request::METHOD_PUT)) {
$resource = $this->findOrCreate($configuration);
} else {
$resource = $this->findOr404($configuration);
}
Contributor
|
This has to be added before Otherwise new resources won't be created. |
Author
|
Ah, I was just wondering why it didn't update anything. Will test. |
Author
|
Duh, I just realised I haven't updated this PR. Feel free to take over or I'll try to find the time to finish it later, after the project launch. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves: https://github.com/Sylius/Sylius/issues/10544