Welcome Guest, Not a member yet? Register   Sign In
Size of my model is very large
#1

(This post was last modified: 07-09-2022, 09:37 AM by groovebird.)

Hi,

i made a var_dump of my model object and it is very large. I see things like the mysql connection with pasword and username. Is this correct or is it a mistake in my model?

PHP Code:
class Test_model extends Model {
    protected 
$table 'table';
    protected 
$primaryKey 'id';
    protected 
$returnType Test_model::class;
}

// the var_dump
App\Models\Test_model Object
(
...

[
db:protected] => CodeIgniter\Database\MySQLi\Connection Object
        
(
            [
DSN:protected] => 
            [
port:protected] => xxx
            
[hostname:protected] => xxx
            
[username:protected] => xxx
            
[password:protected] => xxx
            
[database:protected] => xxx
...
[
classmap:protected] => Array(//output of a huge amount of classnames) 
Reply
#2

It is correct.
Reply
#3

var_dump() will include any instance properties, many of which are injected dependencies. These are all references though so your actual memory size of a Model is still quiet small.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB