Welcome Guest, Not a member yet? Register   Sign In
CodeIgniters Active Record to map against custom objects
#1

[eluser]Kamape[/eluser]
Hi!

If I'll create custom BusinessObjects for different areas in my application (the businessobjects often matches the tables in the database), is there any possibility to map the resultset from the MySQL query to a specified class?

Instead of mapping to a general object array like:

Code:
$this->db->get('products')->result();

$this->db->get('products', 1)->row();

I would like to do this:
Code:
$this->db->get('products')->class_result('Product');

$this->db->get('products', 1)->class_row('Product');

Where I'm specifying the type of class I want to return the result as.

Any ideas??




Theme © iAndrew 2016 - Forum software by © MyBB