Yii Framework Forum: Problems with request values - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problems with request values

#1 User is offline   Néstor Acevedo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 08-January 13
  • Location:Colombia

Posted 20 June 2018 - 06:15 PM

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.
0

#2 User is offline   Néstor Acevedo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 08-January 13
  • Location:Colombia

Posted 22 June 2018 - 11:00 PM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users