Empty entity attributes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Empty entity attributes (/showthread.php?tid=74394) |
Empty entity attributes - Asteria - 09-18-2019 Faced a problem, I can not get data from the entity. For example, Code: $user_entity->username Quote:Call to a member function test_func () on array An entity object is returned by the model. I did everything according to the CI4 documentation, but ran into such a problem. What are the options? RE: Empty entity attributes - dave friend - 09-18-2019 I think showing everyone a little bit more code would make possible reasonable replies. RE: Empty entity attributes - Asteria - 09-18-2019 The sequence of my actions: 1. Create a model Code: <?php namespace App\Models; 2. Create an entity Code: <?php namespace App\Entities; 3. Initialize the model in the controller. Code: $AdminModel = new AdminModel(); 4. Trying to get data from the entity. Code: $admin = $AdminModel->where('username', $this->request->getPost('username')) In case of calling an entity method, I get an error: Quote:Call to a member function verify_pass() on array When accessing entity fields directly, the resulting value = NULL. And in the dd output, my data is visible. |