Symfony How to get class annotation routing parameter from action -


have problem here:

/**  * deal controller.  *  * @route("/portfolio/{portfolio_id}/deal")  */ class dealcontroller extends controller {     // … code here…      /**      * creates new deal entity.      *      * @route("/", name="mb_deal_create")      * @method("post")      * @template("mbportfoliobundle:deal:new.html.twig")      */     public function createaction(request $request)     {     } 

so question: how $portfolio_id route parameter defined in class annotation within createaction?

if i'm trying add parameter parameter list - it's null then:

public function createaction(request $request, $portfolio_id) // no way 

if i'm trying query parameter bag - it's null then:

public function createaction(request $request) {     $portfolio_id = $request->query->get('portfolio_id'); // no way 

so need do?

any appreciated.

thanks , have nice day!

i see you've found solution doesn't hurt put here way solve it:

$context = new requestcontext(); $context->fromrequest($request); $portfolio_id = $context->getparameter('portfolio_id'); 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -