Skip to content

Instantly share code, notes, and snippets.

@neok
Created November 15, 2015 15:44
Show Gist options
  • Save neok/8d2e645ccb69458bf803 to your computer and use it in GitHub Desktop.
Save neok/8d2e645ccb69458bf803 to your computer and use it in GitHub Desktop.
<?php
namespace Acme\DemoBundle\Controller
use FOS\RestBundle\Request\ParamFetcher;
use FOS\RestBundle\Controller\Annotations as Rest;
class ItemExampleController
{
/**
* Get Items By Constraints
*
* @Rest\QueryParam(name="id", array=true, requirements="\d+", default="-1", description="Identifier")
* @Rest\QueryParam(name="active", requirements="\d?", default="1", description="Active item")
* @Rest\View()
*
* @param ParamFetcher $paramFetcher
*/
public function getListItemsAtion(ParamFetcher $paramFetcher) {
$parameters = $paramFetcher->all();
return $this->getResource($parameters);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment