-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4065c74
commit 0785115
Showing
4 changed files
with
36 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,6 @@ | |
namespace Sonata\UserBundle\Controller\Api; | ||
|
||
use FOS\RestBundle\Context\Context; | ||
use FOS\RestBundle\Controller\Annotations\Delete; | ||
use FOS\RestBundle\Controller\Annotations\Get; | ||
use FOS\RestBundle\Controller\Annotations\Post; | ||
use FOS\RestBundle\Controller\Annotations\Put; | ||
use FOS\RestBundle\Controller\Annotations\QueryParam; | ||
use FOS\RestBundle\Controller\Annotations\View; | ||
use FOS\RestBundle\Request\ParamFetcherInterface; | ||
|
@@ -30,12 +26,9 @@ | |
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
/** | ||
* @author Hugo Briand <[email protected]> | ||
* | ||
* @Route(requirements={"_format": "json|xml|html"}, defaults={"_format": "json"}) | ||
*/ | ||
class GroupController | ||
{ | ||
|
@@ -67,8 +60,6 @@ public function __construct(GroupManagerInterface $groupManager, FormFactoryInte | |
* output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}} | ||
* ) | ||
* | ||
* @Get("/groups.{_format}", name="get_groups") | ||
* | ||
* @QueryParam(name="page", requirements="\d+", default="1", description="Page for groups list pagination (1-indexed)") | ||
* @QueryParam(name="count", requirements="\d+", default="10", description="Number of groups by page") | ||
* @QueryParam(name="orderBy", map=true, requirements="ASC|DESC", nullable=true, strict=true, description="Query groups order by clause (key is field, value is direction") | ||
|
@@ -118,8 +109,6 @@ public function getGroupsAction(ParamFetcherInterface $paramFetcher) | |
* } | ||
* ) | ||
* | ||
* @Get("/group/{id}.{_format}", name="get_group") | ||
* | ||
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true) | ||
* | ||
* @param $id | ||
|
@@ -143,8 +132,6 @@ public function getGroupAction($id) | |
* } | ||
* ) | ||
* | ||
* @Post("/group.{_format}", name="post_group") | ||
* | ||
* @param Request $request A Symfony request | ||
* | ||
* @throws NotFoundHttpException | ||
|
@@ -172,8 +159,6 @@ public function postGroupAction(Request $request) | |
* } | ||
* ) | ||
* | ||
* @Put("/group/{id}.{_format}", name="put_group") | ||
* | ||
* @param int $id Group identifier | ||
* @param Request $request A Symfony request | ||
* | ||
|
@@ -200,8 +185,6 @@ public function putGroupAction($id, Request $request) | |
* } | ||
* ) | ||
* | ||
* @Delete("/group/{id}.{_format}", name="delete_group") | ||
* | ||
* @param int $id A Group identifier | ||
* | ||
* @throws NotFoundHttpException | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,6 @@ | |
namespace Sonata\UserBundle\Controller\Api; | ||
|
||
use FOS\RestBundle\Context\Context; | ||
use FOS\RestBundle\Controller\Annotations\Delete; | ||
use FOS\RestBundle\Controller\Annotations\Get; | ||
use FOS\RestBundle\Controller\Annotations\Post; | ||
use FOS\RestBundle\Controller\Annotations\Put; | ||
use FOS\RestBundle\Controller\Annotations\QueryParam; | ||
use FOS\RestBundle\Controller\Annotations\View; | ||
use FOS\RestBundle\Request\ParamFetcherInterface; | ||
|
@@ -32,12 +28,9 @@ | |
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
/** | ||
* @author Hugo Briand <[email protected]> | ||
* | ||
* @Route(requirements={"_format": "json|xml|html"}, defaults={"_format": "json"}) | ||
*/ | ||
class UserController | ||
{ | ||
|
@@ -71,8 +64,6 @@ public function __construct(UserManagerInterface $userManager, GroupManagerInter | |
* output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}} | ||
* ) | ||
* | ||
* @Get("/users.{_format}", name="get_users") | ||
* | ||
* @QueryParam(name="page", requirements="\d+", default="1", description="Page for users list pagination (1-indexed)") | ||
* @QueryParam(name="count", requirements="\d+", default="10", description="Number of users by page") | ||
* @QueryParam(name="orderBy", map=true, requirements="ASC|DESC", nullable=true, strict=true, description="Query users order by clause (key is field, value is direction") | ||
|
@@ -122,8 +113,6 @@ public function getUsersAction(ParamFetcherInterface $paramFetcher) | |
* } | ||
* ) | ||
* | ||
* @Get("/user/{id}.{_format}", name="get_user") | ||
* | ||
* @View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true) | ||
* | ||
* @param $id | ||
|
@@ -147,8 +136,6 @@ public function getUserAction($id) | |
* } | ||
* ) | ||
* | ||
* @Post("/user.{_format}", name="post_user") | ||
* | ||
* @param Request $request A Symfony request | ||
* | ||
* @throws NotFoundHttpException | ||
|
@@ -176,8 +163,6 @@ public function postUserAction(Request $request) | |
* } | ||
* ) | ||
* | ||
* @Put("/user/{id}.{_format}", name="put_user") | ||
* | ||
* @param int $id User id | ||
* @param Request $request A Symfony request | ||
* | ||
|
@@ -204,8 +189,6 @@ public function putUserAction($id, Request $request) | |
* } | ||
* ) | ||
* | ||
* @Delete("/user/{id}.{_format}", name="delete_user") | ||
* | ||
* @param int $id An User identifier | ||
* | ||
* @throws NotFoundHttpException | ||
|
@@ -237,8 +220,6 @@ public function deleteUserAction($id) | |
* } | ||
* ) | ||
* | ||
* @Post("/user/{userId}/{groupId}.{_format}", name="post_user_group") | ||
* | ||
* @param int $userId A User identifier | ||
* @param int $groupId A Group identifier | ||
* | ||
|
@@ -280,8 +261,6 @@ public function postUserGroupAction($userId, $groupId) | |
* } | ||
* ) | ||
* | ||
* @Delete("/user/{userId}/{groupId}.{_format}", name="delete_user_group") | ||
* | ||
* @param int $userId A User identifier | ||
* @param int $groupId A Group identifier | ||
* | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<routes xmlns="http://symfony.com/schema/routing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing https://symfony.com/schema/routing/routing-1.0.xsd"> | ||
<import resource="Sonata\UserBundle\Controller\Api\UserController" type="annotation" name-prefix="sonata_api_user_user_"/> | ||
<import resource="Sonata\UserBundle\Controller\Api\GroupController" type="annotation" name-prefix="sonata_api_user_group_"/> | ||
<route id="sonata_api_user_group_delete_group" path="/group/{id}.{_format}" methods="DELETE" controller="Sonata\UserBundle\Controller\Api\GroupController::deleteGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_group_get_group" path="/group/{id}.{_format}" methods="GET" controller="Sonata\UserBundle\Controller\Api\GroupController::getGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_group_get_groups" path="/groups.{_format}" methods="GET" controller="Sonata\UserBundle\Controller\Api\GroupController::getGroupsAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_group_post_group" path="/group.{_format}" methods="POST" controller="Sonata\UserBundle\Controller\Api\GroupController::postGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_group_put_group" path="/group/{id}.{_format}" methods="PUT" controller="Sonata\UserBundle\Controller\Api\GroupController::putGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_delete_user" path="/user/{id}.{_format}" methods="DELETE" controller="Sonata\UserBundle\Controller\Api\UserController::deleteUserAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_delete_user_group" path="/user/{userId}/{groupId}.{_format}" methods="DELETE" controller="Sonata\UserBundle\Controller\Api\UserController::deleteUserGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_get_user" path="/user/{id}.{_format}" methods="GET" controller="Sonata\UserBundle\Controller\Api\UserController::getUserAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_get_users" path="/users.{_format}" methods="GET" controller="Sonata\UserBundle\Controller\Api\UserController::getUsersAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_post_user" path="/user.{_format}" methods="POST" controller="Sonata\UserBundle\Controller\Api\UserController::postUsersAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_post_user_group" path="/user/{userId}/{groupId}.{_format}" methods="POST" controller="Sonata\UserBundle\Controller\Api\UserController::postUserGroupAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
<route id="sonata_api_user_user_put_user" path="/user/{id}.{_format}" methods="PUT" controller="Sonata\UserBundle\Controller\Api\UserController::putUsersAction" format="json"> | ||
<requirement key="_format">json|xml|html</requirement> | ||
</route> | ||
</routes> |