-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Less boilerplate route definitions
- Loading branch information
Chris Young
committed
Sep 13, 2016
1 parent
c2f9ca6
commit 012176f
Showing
8 changed files
with
60 additions
and
167 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
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
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
24 changes: 24 additions & 0 deletions
24
src/Darkbluesun/GoldfishBundle/Controller/API/UserController.php
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Darkbluesun\GoldfishBundle\Controller\API; | ||
|
||
use FOS\RestBundle\Routing\ClassResourceInterface; | ||
use JMS\Serializer\SerializationContext; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
|
||
class UserController extends Controller implements ClassResourceInterface | ||
{ | ||
public function cgetAction() | ||
{ | ||
$user = $this->getUser(); | ||
$workspace = $user->getWorkspace(); | ||
|
||
return new Response( | ||
$this->get('serializer')->serialize( | ||
$workspace->getUsers(), 'json', | ||
SerializationContext::create()->setGroups(['user_list']) | ||
)); | ||
} | ||
|
||
} |
Oops, something went wrong.