Skip to content

Ease custom operation configuration #1732

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

Merged

Conversation

antograssiot
Copy link
Contributor

@antograssiot antograssiot commented Feb 24, 2018

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR will open this is upvoted

Inspired by and following #1470 This PR aims to give a shortcut configuration for custom operation. Over the time I find my self repeating this code a lot.

Before:

/**
 * @ApiResource(
 *     collectionOperations={
 *         "get",
 *         "post",
 *         "custom_denormalization_action"={"route_name"="custom_denormalization_action"},
 *     },
 *     itemOperations={
 *         "get",
 *         "put",
 *         "custom_normalization_action"={"route_name"="custom_normalization_action"},
 *     }
 * )
 */

After:

/**
 * @ApiResource(
 *     collectionOperations={"get", "post", "custom_denormalization_action"},
 *     itemOperations={"get", "put", "custom_normalization_action"}
 * )
 */

@antograssiot antograssiot force-pushed the custom-operation-configuration branch from 0f65a7a to 142b23d Compare February 24, 2018 12:22
@antograssiot
Copy link
Contributor Author

I'll prepare a doc PR

@dunglas dunglas merged commit 0ec68c0 into api-platform:master Mar 3, 2018
@dunglas
Copy link
Member

dunglas commented Mar 3, 2018

Thanks again Anto!

@antograssiot antograssiot deleted the custom-operation-configuration branch March 3, 2018 15:08
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.

3 participants