Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User model doesn't have any properties #44

Open
amsharma9 opened this issue Jul 19, 2020 · 1 comment
Open

User model doesn't have any properties #44

amsharma9 opened this issue Jul 19, 2020 · 1 comment

Comments

@amsharma9
Copy link

amsharma9 commented Jul 19, 2020

Hi,

A basic question, how come Users model has no properties like username, password, email etc. This code was working till now but doesn't seem to work anymore. I don't understand. The code on line 124-126 has:

$this->username = $this->request->getPost('username');
$this->password = $this->getDI()->getShared('auth')->hash($this->request->getPost('password'));
$this->email = $this->request->getPost('email');       

but there is no username, password, email in the model. How was it working? Am I missing something.

I have another related question, how come $this->request->getPost works in a model, this should work only in a controller, right. The request object is null when I execute the code now.

Thanks
Amal

@mruz
Copy link
Owner

mruz commented Jul 23, 2020

There was a magic __get() to get access to these values. I think phalcon team changed the models in the 4.0.

About the request in the models; it was available because of:

$this->request = $this->getDI()->getShared('request');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants