![]() |
Extend Active Record Class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Extend Active Record Class (/showthread.php?tid=8998) |
Extend Active Record Class - El Forum - 06-08-2008 [eluser]stoefln[/eluser] Is it possible to write my own container class for the data? i mean somehow this way: Code: $query = $this->db->get_where('types',array('id' => $typeId)); Extend Active Record Class - El Forum - 06-08-2008 [eluser]m4rw3r[/eluser] No, but you can fetch the data and then pass it to a container: Code: $query = $this->db->get_where('types',array('id' => $typeId)); EDIT: My IgnitedRecord model has support for custom container classes. Extend Active Record Class - El Forum - 06-09-2008 [eluser]stoefln[/eluser] [quote author="m4rw3r" date="1212948856"]No, but you can fetch the data and then pass it to a container: Code: $query = $this->db->get_where('types',array('id' => $typeId)); EDIT: My IgnitedRecord model has support for custom container classes.[/quote] thanks, nice proposal! the problem is that on huge result sets there have to be twice as much instances made as without the wrapper objects, think that could be a performance-issue. anyway, your ignitedrecord model looks quite impressive, will take a closer look on it. how would you include the Type.php in the typesmodel.php file, is there a CI-style-way of achieving that? Extend Active Record Class - El Forum - 06-09-2008 [eluser]m4rw3r[/eluser] This: Code: class Type{ Code: class Type{ About the includes: There is no "CI way" of including associated classes, not yet at least. But do what you feel is right, include, require (or the *_once), $this->load->library(...) or whatever. I recommend using the APPPATH constant (yes three P ![]() Code: require_once APPPATH.'/myclassdir/type.php'; |