Welcome Guest, Not a member yet? Register   Sign In
Datamapper ORM v 1.80 huge Array
#1

[eluser]da_mage[/eluser]
Hi,
I'm using Datamapper ORM v 1.80.
And realised that it returns a huge array

here is my code:

Code:
$user= new User('id',1);
    print_r($user);
    die('ok');

Im searching only for the user with id 1
The table Users has about 15 fields
and at this moment there are only 2 records inside the table.
yet it will return a page or two long full of array objects.
I can see that amongst the array objects is also my codeigniter main config file?? and datamappers config Items..
#2

[eluser]WanWizard[/eluser]
Try to understand how PHP, and CodeIgniter work.

In PHP5, all objects are assigned by reference. This means that although you see them when you access a Datamapper object, they are not copies, and don't take up memory.

CodeIgniter works by assigning all objects as singletons to $this, so a var_dump($this) will show you pages and pages of object information. All other objects that access CI ( either via an automatic mechanism or through get_instance() ) use references.

So obviously you'll see all this when you dump a Datamapper object. Because Datamapper accesses the database, language, and form validation libraries, which in turn have links to several other libraries.
#3

[eluser]da_mage[/eluser]
WOW...Thank you for claryfing this WanWizard.
and for your super quick reply.
I thought I was doing something wrong ...
you're the bestSmile
now I can happily get back to coding againSmile
Tnx.




Theme © iAndrew 2016 - Forum software by © MyBB