CodeIgniter Forums
Does New Model Object creates new MySQL connection ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Does New Model Object creates new MySQL connection ? (/showthread.php?tid=80018)



Does New Model Object creates new MySQL connection ? - iot - 09-02-2021

Hello everybody,
I would like to ask a question. I have a Model class
PHP Code:
class UserModel extends Model 

What happened if I create an object of User Model
PHP Code:
$dbuser new UserModel(); 

Does it create one database connection per one object?

Thank you in advance!


RE: Does New Model Object creates new MySQL connection ? - ikesela - 09-02-2021

only one connection, it should be persistent connection. instance is shared