Skip to content

Make it easier to configure operations #1470

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
merged 1 commit into from
Nov 1, 2017

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Oct 31, 2017

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR todo

Before:

/**
 * @ApiResource(
 *     collectionOperations={
 *         "get"={"method"="GET"},
 *         "post"={"method"="POST"}
 *     },
 *     itemOperations={
 *         "get"={"method"="GET"}
 *     }
 */

Now:

/**
 * @ApiResource(
 *     collectionOperations={"get", "post"},
 *     itemOperations={"get"}
 */

Before:

/**
 * @ApiResource(
 *     attributes={"access_control"="has_role('ROLE_USER')"},
 *     collectionOperations={
 *         "get"={"method"="GET"},
 *         "post"={"method"="POST", "access_control"="has_role('ROLE_ADMIN')"}
 *     },
 *     itemOperations={
 *         "get"={"method"="GET", "access_control"="has_role('ROLE_USER') and object.getOwner() == user"}
 *     }
 */

Now:

/**
 * @ApiResource(
 *     attributes={"access_control"="has_role('ROLE_USER')"},
 *     collectionOperations={
 *         "get",
 *         "post"={"access_control"="has_role('ROLE_ADMIN')"}
 *     },
 *     itemOperations={
 *         "get"={"access_control"="has_role('ROLE_USER') and object.getOwner() == user"}
 *     }
 */

Also includes unit tests for existing features of OperationResourceMetadataFactory, support for YAML and XML and various minor improvements.

@lyrixx
Copy link
Contributor

lyrixx commented Oct 31, 2017

👍 for the UX ;)

@sroze sroze merged commit 8a3b593 into api-platform:master Nov 1, 2017
hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
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.

5 participants