We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

getPut() returns null when trying to get a param from request

    if($request->isPut()==true)
    {
        //check auth_token parameters
        $auth_token = $request->getPut('auth_token');

        //create and execute query
        $select_user_query = "SELECT * FROM User WHERE auth_token = :auth_token:";
        $user = $this->modelsManager->executeQuery($select_user_query, array('auth_token' => $auth_token))->getFirst();

When trying to get the auth_token from put request, it returns null so the query doesn't work. What's the problem? The if condition to detect request type works very good but getPut() doesn't.

Have you tried checking the contents of the put request?

var_dump($request->getPut()) 

I tested just now with curl and had no problem

array (size=2)
  'asdfasdf' => string 'asdfsadf' (length=8)
  'key' => string 'asdfsadf' (length=8)

If your keys arent listed in that I would imagine the problem is in the form encoding itself. Perhaps this method was only tested with API's and not with Phalcon forms.

Thank you for your answear. I used put for API, not for forms. I will try again soon, I used other way to do the same thing.