Problems with request values


(Nacevedo) #1

Hi all. I’m having some issues with post forms. Currently, I have 2 controllers: UserController and RequirementController.

At this point, is not important the code controller, I just followed the guide for RESTful that is enough to me.

I’m able to receive post data on UserController but not in RequirementController.

In UserController I only overrided the create action




public function actionCreate()

{


        $model = new User;

        $post = $_REQUEST; // $_REQUEST works, not $_POST

        ...

}



The rules for this controller are:


[

   'class' => 'yii\rest\UrlRule',

   'controller' => 'user',

   'extraPatterns' => [

      'POST create' => 'create',

   ],

],



Similar situation for RequirementController, but in this case, I’m unable to get any param:




public function actionCreate()

{


        $model = new Requirement;

        $post = $_REQUEST; // here $_REQUESTS doesn't work

        ...

}



The rules for Requirement are the same.




[

   'class' => 'yii\rest\UrlRule',

   'controller' => 'requirement',

   'extraPatterns' => [

      'POST create' => 'create',

   ],

],



How do I to catch the POST params sent from form to RequirementController if I’m able to do it on UserController?

I’m using RESTED extension for Mozilla Firefox, and the same performance is noticed in Postman.


(Nacevedo) #2

Ok finally I achieved, changed from custom rest rooms to "classic" controller/action rule, but toY took too much time to get the request body.

Btw, I’m using dummycache.