user10886299
user10886299

Reputation:

FOSRestBundle Annotations for GET

I am currently developing an API and am using FOSRestBundle. I've gone wrong somewhere with the annotation side of my controller.

Please see my code below:

use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;

class DefaultController extends FOSRestController
{
    /**
     * @Rest\("/default/{string})
     * @param string $string
     */
    public function defaultAction($string)
    {}
}

I am trying to to pass a parameter to the default action and do something with it. However, the parameter I include in the URL isn't getting passed to the action. Any help will be appreciated.

Upvotes: 1

Views: 510

Answers (1)

Alex
Alex

Reputation: 1099

You're just missing the Get from your first annotation, it should be: @Rest\Get("/default/{string}")

Upvotes: 1

Related Questions