Aim : Send an Http request as an array (i'm looking to the uri syntax if it's possible to send an array by the header of the Http)
Server Side
ProfilHandler.php My Profil Handler
/**
* Get a list of News.
*
* @param int $limit the limit of the result
* @param int $offset starting from the offset
* @param array $sector get profils by sectors
*
* @return array
*/
public function all($limit = 5, $offset = 0,$sector)
{
return $this->repository->findBy(array(), null, $limit, $offset, $sector);
}
ProfilController.php My Profil Controller
/**
* List all profiles.
*
* @ApiDoc(
* resource = true,
* statusCodes = {
* 200 = "Returned when successful"
* }
* )
*
* @Annotations\QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing profiles.")
* @Annotations\QueryParam(name="limit", requirements="\d+", default="10", description="How many pages to return.")
* @Annotations\QueryParam(name="sector", requirements="\d+", default="IT", description="How many pages to return.")
*
* @Annotations\View(
* templateVar="profiles"
* )
*
* @param Request $request the request object
* @param ParamFetcherInterface $paramFetcher param fetcher service
*
* @return array
*/
// ....
public function getProfilsAction(Request $request, ParamFetcherInterface $paramFetcher)
{
$offset = $paramFetcher->get('offset');
$offset = null == $offset ? 0 : $offset;
$limit = $paramFetcher->get('limit');
$secteur = $paramFetcher->get('sector');
return $this->container->get('genius_profile.profil.handler')->all($limit, $offset,$sector);
}