Symfony form values ​​are missing

I wrote a simple login form, everything works fine (check, etc.), but I can not get the values, there is my code:

public function executeIndex(sfWebRequest $request)
  {
      $this->getUser()->clearCredentials();
      $this->getUser()->setAuthenticated(false);

      $this->form = new LoginForm();

      if ($request->isMethod('post') && $request->hasParameter('login')) {
          $this->form->bind($request->getParameter('login'));

          if ($this->form->isValid()) {

              $this->getUser()->setAuthenticated(true);
              $this->getUser()->addCredential('user');
              $this->login = $this->form->getValue('login');
          }
      }
  }

$ this-> login - NULL. Now I checked almost everything, the form is valid, isBound () is true, count () returns 3, I can see the values ​​in my query:

parameterHolder:
  action: index
  login: { login: foo, password: foo, _csrf_token: 53ebddee1883d7e3d6575d6fb1707a15 }
  module: login

BUT getValues ​​() returns NULL, getValue ('login'), etc. also returns null. How can it be?

And no, I do not want to use sfGuard-Plugins;)

+3
source share
2 answers

How about trying something like this

$form['value_name']->getValue()

Is it still NULL?

Is it also possible that you created a personalized mail validator?

+4
source

:

return $values;
0

Source: https://habr.com/ru/post/1741665/


All Articles