Answer the question
In order to leave comments, you need to log in
Why can't I log in if I redefine the users array in yii2 to exactly the same one?
Greetings gentlemen. Instead of a regular array, I want to use an array from a database. I've done this before in another project and it worked fine, now it doesn't.
To start with the code: Here are
some explanations for it:
1. I'm commenting out the standard array.
2. I make a constructor method, from which I call another method, in which I want to override with an array from the database (the second piece of code). Do not ask why not do it right away in the constructor, I have my own atmosphere and tasks (:
3. I override the property $this->users = $users;
Everything is ok, but I see an error when submitting the login form:
I thought that the array from the database came in a different format, I began to debug it, and for debugging, I simply override it in the getUsers() method with its own standard array (i.e. I use all the code from the first screenshot as in the picture) and exactly the same an error that in the second screenshot when submitting the login form.
The array was redefined because in the controller, when:
$user = new User();
var_dump($user->users); die();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question