Can phalcon auto bind request parameter to controller?

If I create a controller with attribute, can phalcon auto assign value to these attribute?


class LoginController extends BaseController

    public function indexAction()
        //Don't use this to get parameter


No, it can't. The code that runs in your function cannot have other code injected into it, so there is no way to have $username defined. $this->username could be defined, but I don't think Phalcon does this. In truth, you wouldn't want to do that anyway, because then $username would become a bit of a magic variable - when you (or someone else) is debugging, it wouldn't be obvious from the code where $username gets initialized. Using $this->request->getPost('username') is the best way, because then it's clear where $username got its value.