CodeIgniter Forums
[ASK] Why using ORM? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [ASK] Why using ORM? (/showthread.php?tid=40216)



[ASK] Why using ORM? - El Forum - 04-01-2011

[eluser]Unknown[/eluser]
Sorry if there were similar questions like mine before,

Quote:i'm just confused, why us people using other ORM like Doctrine to maintain database beside using active record class provided by CI Core? Isn't it less secure?

thank you!!


[ASK] Why using ORM? - El Forum - 04-01-2011

[eluser]ipsod[/eluser]
The active record class provided by CI isn't an ORM like PHPActiveRecord.

ORM classes give cool features like:
Code:
$p = new Product();
$p->where_related_category('title', 'Marbles')->get(10);
which fills $p with an array of the first 10 product entries where the related category's title is "Marbles". Isn't that awesome? (In the example "category" is a related database, "title" is a field in the "category" database, and "Marbles" is a specific entry in the title field)

No, it's not less secure if you do it right. It's slightly slower (adds about .01 seconds on my server), since it has to build a somewhat complex object, but well worth it for my purposes, especially since I cache everything large to the file system as things are entered to the database.

I use DMZ, which is built on top of CI's active record and built according to CI's design goals (low overhead, high speed, simple, etc.), and recommend it.