-
-
Notifications
You must be signed in to change notification settings - Fork 900
fixed registration order of routes and added operation name #5105
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
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
$this->legacyOperationsToOperations($this->getLegacyOperations()), | ||
$this->legacyOperationsToOperations($this->getLegacyOperations(true), true) | ||
$this->legacyOperationsToOperations($this->getLegacyOperations(true), true), | ||
$this->legacyOperationsToOperations($this->getLegacyOperations()) |
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 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.
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.
@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.
@@ -443,6 +443,9 @@ private function legacyOperationsToOperations($legacyOperations, bool $isCollect | |||
|
|||
$method = $operation['method'] ?? strtoupper($operationName); | |||
unset($operation['method']); | |||
if(!in_array($operationName, ['get', 'post', 'put', 'patch', 'delete'])) { | |||
$operation['name']= $operationName; |
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'll keep this patch, it's a good idea thanks!
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.
@soyuka Great, I am very pleased to have been helpful.
origin: #5105 Co-authored-by: WilliamPeralta <[email protected]>
Thanks I continued your work at 5109 |
origin: api-platform#5105 Co-authored-by: WilliamPeralta <[email protected]>
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <[email protected]> Co-authored-by: ArnoudThibaut <[email protected]> Co-authored-by: davy-beauzil <[email protected]> Co-authored-by: Baptiste Leduc <[email protected]> Co-authored-by: Xavier Laviron <[email protected]> Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Liviu Cristian Mirea-Ghiban <[email protected]> Co-authored-by: Liviu Mirea <[email protected]> Co-authored-by: WilliamPeralta <[email protected]>
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <[email protected]> Co-authored-by: ArnoudThibaut <[email protected]> Co-authored-by: davy-beauzil <[email protected]> Co-authored-by: Baptiste Leduc <[email protected]> Co-authored-by: Xavier Laviron <[email protected]> Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Liviu Cristian Mirea-Ghiban <[email protected]> Co-authored-by: Liviu Mirea <[email protected]> Co-authored-by: WilliamPeralta <[email protected]>
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <[email protected]> Co-authored-by: ArnoudThibaut <[email protected]> Co-authored-by: davy-beauzil <[email protected]> Co-authored-by: Baptiste Leduc <[email protected]> Co-authored-by: Xavier Laviron <[email protected]> Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Liviu Cristian Mirea-Ghiban <[email protected]> Co-authored-by: Liviu Mirea <[email protected]> Co-authored-by: WilliamPeralta <[email protected]>
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * chore: v2.7.3 changelog * chore: v3.0.3 changelog Co-authored-by: helyakin <[email protected]> Co-authored-by: ArnoudThibaut <[email protected]> Co-authored-by: davy-beauzil <[email protected]> Co-authored-by: Baptiste Leduc <[email protected]> Co-authored-by: Xavier Laviron <[email protected]> Co-authored-by: Alan Poulain <[email protected]> Co-authored-by: Liviu Cristian Mirea-Ghiban <[email protected]> Co-authored-by: Liviu Mirea <[email protected]> Co-authored-by: WilliamPeralta <[email protected]>
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