iyi çalışıyor alır, ben, yolları ek açıklamaları ile ilgili bir sorun bilmiyorum yazı içinPOST rota açıklama Symfony2
/**
* @QueryParam(name="offset", requirements="\d+", nullable=true, description="Offset from which to start listing pages.")
* @QueryParam(name="limit", requirements="\d+", nullable=true, default="20", description="How many pages to return.")
*
* @View()
*
* @param Request $request the request object
* @param ParamFetcherInterface $paramFetcher param fetcher service
* GET Route annotation.
* @Get("https://stackoverflow.com/users/")
* @return array
*/
public function getUsersAction(Request $request, ParamFetcherInterface $paramFetcher)
{
$offset = $paramFetcher->get('offset');
$offset = null == $offset ? 0 : $offset;
$limit = $paramFetcher->get('limit');
return $this->container->get('user.handler')->all($limit, $offset);
}
aşağıdaki gibi get benim kodudur aşağıdaki gibi bunu nasıl benim kod i url kullanıcının attribues eklemek istediğiniz, yani plz nasıl
/**
* @View(template = "UserBundle:User:register.html.twig", statusCode = Codes::HTTP_BAD_REQUEST, templateVar = "form")
*
* @param Request $request the request object
* POST Route annotation.
* @Post("https://stackoverflow.com/users/")
* @return FormTypeInterface|View
*/
public function postUserAction(Request $request)
{
try {
$newUser = $this->get('user.handler')->post($request);
$routeOptions = array(
'id' => $newUser->getId(),
'_format' => $request->get('_format')
);
return $this->routeRedirectView('get_user', $routeOptions, Codes::HTTP_CREATED);
} catch (InvalidFormException $exception) {
return $exception->getForm();
}
}
FOSRestBundle'ı kullandığınızdan bahsetmeyi unutmuşsunuzdur. Bu doğru mu? – Andras
evet fosRestBundle – Ndb