Upgrade Model CI3 to CI4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Upgrade Model CI3 to CI4 (/showthread.php?tid=78607) |
Upgrade Model CI3 to CI4 - cloude - 02-14-2021 Hi all. I'm trying to upgrade CI3 to CI4 adding namespace and use, but Visual Studio code get 'Undefined method select'. Thanks in advance for help. PHP Code: namespace App\Models; // CI4 RE: Upgrade Model CI3 to CI4 - iRedds - 02-14-2021 The $db property contains the connection to the database. To work with Query Builder you need to get an instance of it. PHP Code: $builder = $this->db->table('table'); The result() method no longer exists. Use getResult(). Also orWhere, orderBy, groupStart, etc https://codeigniter.com/user_guide/database/index.html RE: Upgrade Model CI3 to CI4 - wdeda - 02-14-2021 Just a Model sample PHP Code: <?php RE: Upgrade Model CI3 to CI4 - Chivinsdev - 02-16-2021 Try this I hope it will help you get what you are looking for PHP Code: namespace App\Models; I just hope it will help you else call me back to it. I am here to help and also receive help |