fixed registration order of routes and added operation name#5105
Closed
WilliamPeralta wants to merge 1 commit into
Closed
fixed registration order of routes and added operation name#5105WilliamPeralta wants to merge 1 commit into
WilliamPeralta wants to merge 1 commit into
Conversation
I have adjusted the order of the registration of the routes to avoid that itemOperations conflict with collection operation.
For instance:
```
api/books/avaliable
api/books/{id}
```
instead of
```
api/books/{id}
api/books/avaliable
```
I also added the name of the operation that I use a lot in the "doctrine extension" and they are not there anymore than after the migration
soyuka
reviewed
Nov 2, 2022
| $this->legacyOperationsToOperations($this->getLegacyOperations()), | ||
| $this->legacyOperationsToOperations($this->getLegacyOperations(true), true) | ||
| $this->legacyOperationsToOperations($this->getLegacyOperations(true), true), | ||
| $this->legacyOperationsToOperations($this->getLegacyOperations()) |
Member
There was a problem hiding this comment.
this can't be the default, indeed in API Platform 3 we recommend to put the item GET operation as first one because this is the one that identifies the Resource in the first place.
Contributor
Author
There was a problem hiding this comment.
@soyuka you kindly tell me how I can avoid that the route of the "itemOperation" take also the customized routes without changing the order? i get a 404 error if i put itemoperation first.
soyuka
reviewed
Nov 2, 2022
| $method = $operation['method'] ?? strtoupper($operationName); | ||
| unset($operation['method']); | ||
| if(!in_array($operationName, ['get', 'post', 'put', 'patch', 'delete'])) { | ||
| $operation['name']= $operationName; |
Member
There was a problem hiding this comment.
I'll keep this patch, it's a good idea thanks!
Contributor
Author
There was a problem hiding this comment.
@soyuka Great, I am very pleased to have been helpful.
soyuka
pushed a commit
to soyuka/core
that referenced
this pull request
Nov 2, 2022
soyuka
pushed a commit
to soyuka/core
that referenced
this pull request
Nov 4, 2022
soyuka
added a commit
that referenced
this pull request
Nov 4, 2022
origin: #5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
Member
|
Thanks I continued your work at 5109 |
soyuka
added a commit
to soyuka/core
that referenced
this pull request
Nov 4, 2022
origin: api-platform#5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka
added a commit
that referenced
this pull request
Nov 4, 2022
* fix: update yaml extractor test file coding standard (#5068) * fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064) * fix(metadata): add class key in payload argument resolver (#5067) * fix: add class key in payload argument resolver * add null if everything else goes wrong * fix: upgrade command remove ApiSubresource attribute (#5049) Fixes #5038 * fix(doctrine): use abitrary index instead of value (#5079) * fix: uri template should respect rfc 6570 (#5080) * fix: remove @internal annotation for Operations (#5089) See #5084 * fix(metadata): define a name on a single operation (#5090) fixes #5082 * fix(metadata): deprecate when user decorates in legacy mode (#5091) fixes #5078 * fix(graphql): use right nested operation (#5102) * Revert "fix(graphql): use right nested operation (#5102)" (#5111) This reverts commit 44337dd. * fix(graphql): always allow to query nested resources (#5112) * fix(graphql): always allow to query nested resources * review Co-authored-by: Alan Poulain <contact@alanpoulain.eu> * chore: php-cs-fixer update * fix: only alias if exists for opcache preload Fixes api-platform/api-platform#2284 (#5110) Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> * chore: php-cs-fixer update (#5118) * chore: php-cs-fixer update * chore: php-cs-fixer update * fix(metadata): upgrade script keep operation name (#5109) origin: #5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <CourcierMarvin@gmail.com> Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com> Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com> Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com> Co-authored-by: Xavier Laviron <norival@users.noreply.github.com> Co-authored-by: Alan Poulain <contact@alanpoulain.eu> Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com> Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka
added a commit
to api-platform/symfony
that referenced
this pull request
Sep 13, 2023
* fix: update yaml extractor test file coding standard (#5068) * fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064) * fix(metadata): add class key in payload argument resolver (#5067) * fix: add class key in payload argument resolver * add null if everything else goes wrong * fix: upgrade command remove ApiSubresource attribute (#5049) Fixes #5038 * fix(doctrine): use abitrary index instead of value (#5079) * fix: uri template should respect rfc 6570 (#5080) * fix: remove @internal annotation for Operations (#5089) See #5084 * fix(metadata): define a name on a single operation (#5090) fixes #5082 * fix(metadata): deprecate when user decorates in legacy mode (#5091) fixes #5078 * fix(graphql): use right nested operation (#5102) * Revert "fix(graphql): use right nested operation (#5102)" (#5111) This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b. * fix(graphql): always allow to query nested resources (#5112) * fix(graphql): always allow to query nested resources * review Co-authored-by: Alan Poulain <contact@alanpoulain.eu> * chore: php-cs-fixer update * fix: only alias if exists for opcache preload Fixes api-platform/api-platform#2284 (#5110) Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> * chore: php-cs-fixer update (#5118) * chore: php-cs-fixer update * chore: php-cs-fixer update * fix(metadata): upgrade script keep operation name (#5109) origin: api-platform/core#5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <CourcierMarvin@gmail.com> Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com> Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com> Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com> Co-authored-by: Xavier Laviron <norival@users.noreply.github.com> Co-authored-by: Alan Poulain <contact@alanpoulain.eu> Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com> Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka
added a commit
to api-platform/graphql
that referenced
this pull request
Sep 13, 2023
* fix: update yaml extractor test file coding standard (#5068) * fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064) * fix(metadata): add class key in payload argument resolver (#5067) * fix: add class key in payload argument resolver * add null if everything else goes wrong * fix: upgrade command remove ApiSubresource attribute (#5049) Fixes #5038 * fix(doctrine): use abitrary index instead of value (#5079) * fix: uri template should respect rfc 6570 (#5080) * fix: remove @internal annotation for Operations (#5089) See #5084 * fix(metadata): define a name on a single operation (#5090) fixes #5082 * fix(metadata): deprecate when user decorates in legacy mode (#5091) fixes #5078 * fix(graphql): use right nested operation (#5102) * Revert "fix(graphql): use right nested operation (#5102)" (#5111) This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b. * fix(graphql): always allow to query nested resources (#5112) * fix(graphql): always allow to query nested resources * review Co-authored-by: Alan Poulain <contact@alanpoulain.eu> * chore: php-cs-fixer update * fix: only alias if exists for opcache preload Fixes api-platform/api-platform#2284 (#5110) Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> * chore: php-cs-fixer update (#5118) * chore: php-cs-fixer update * chore: php-cs-fixer update * fix(metadata): upgrade script keep operation name (#5109) origin: api-platform/core#5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <CourcierMarvin@gmail.com> Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com> Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com> Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com> Co-authored-by: Xavier Laviron <norival@users.noreply.github.com> Co-authored-by: Alan Poulain <contact@alanpoulain.eu> Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com> Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
soyuka
added a commit
to api-platform/doctrine-odm
that referenced
this pull request
Jan 25, 2024
* fix: update yaml extractor test file coding standard (#5068) * fix(graphql): add clearer error message when TwigBundle is disabled but graphQL clients are enabled (#5064) * fix(metadata): add class key in payload argument resolver (#5067) * fix: add class key in payload argument resolver * add null if everything else goes wrong * fix: upgrade command remove ApiSubresource attribute (#5049) Fixes #5038 * fix(doctrine): use abitrary index instead of value (#5079) * fix: uri template should respect rfc 6570 (#5080) * fix: remove @internal annotation for Operations (#5089) See #5084 * fix(metadata): define a name on a single operation (#5090) fixes #5082 * fix(metadata): deprecate when user decorates in legacy mode (#5091) fixes #5078 * fix(graphql): use right nested operation (#5102) * Revert "fix(graphql): use right nested operation (#5102)" (#5111) This reverts commit 44337ddb3908d7b05ed75b75325b7941581f575b. * fix(graphql): always allow to query nested resources (#5112) * fix(graphql): always allow to query nested resources * review Co-authored-by: Alan Poulain <contact@alanpoulain.eu> * chore: php-cs-fixer update * fix: only alias if exists for opcache preload Fixes api-platform/api-platform#2284 (#5110) Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> * chore: php-cs-fixer update (#5118) * chore: php-cs-fixer update * chore: php-cs-fixer update * fix(metadata): upgrade script keep operation name (#5109) origin: api-platform/core#5105 Co-authored-by: WilliamPeralta <william.peralta18@gmail.com> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <CourcierMarvin@gmail.com> Co-authored-by: ArnoudThibaut <thibaut.arnoud@gmail.com> Co-authored-by: davy-beauzil <38990335+davy-beauzil@users.noreply.github.com> Co-authored-by: Baptiste Leduc <baptiste.leduc@gmail.com> Co-authored-by: Xavier Laviron <norival@users.noreply.github.com> Co-authored-by: Alan Poulain <contact@alanpoulain.eu> Co-authored-by: Liviu Cristian Mirea-Ghiban <contact@liviucmg.com> Co-authored-by: Liviu Mirea <liviu.mirea@wecodepixels.com> Co-authored-by: WilliamPeralta <william.peralta18@gmail.com>
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.
I have adjusted the order of the registration of the routes to avoid that itemOperations conflict with collection operation. For instance:
instead of
I also added the name of the operation that I use a lot in the "doctrine extension" and they are not there anymore than after the migration