Skip to content

Instantly share code, notes, and snippets.

@mneuhaus
Created February 10, 2017 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mneuhaus/5fa74b5d358e4ef59e58ddef3c1d735d to your computer and use it in GitHub Desktop.
Save mneuhaus/5fa74b5d358e4ef59e58ddef3c1d735d to your computer and use it in GitHub Desktop.
<?php
class ApiController {
/**
* @Route("/api/search")
*/
public function searchAction(Request $request){
$request->get('value');
...do a search...
}
/**
* @Route("/api/teams")
*/
public function teamsAction($id, Request $request){
...get all teams...
}
/**
* @Route("/api/teams/{teamId}/add/{memberId}")
*/
public function addMemberToTeamAction($teamId, $memberId, Request $request){
$team = $this->teamRepository->findOneById($teamId);
$member = $this->teamRepository->findOneById($memberId);
$team->addMember($member);
$manager->persist($team);
$manager->flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment