[eluser]jkarlen[/eluser]
I'm working on an order management system and I'm trying to load an array of OrderProduct items within my Order object. However, it appears that the load method is only firing once as if I look at an order with many items on it the result is a list of all identical items.
I appologize if this is a novice question - but when it comes to code igniter that's what I am.
function get_products()
{
$query = $this->CI->db->get_where('xxx.order_product', array('order_id' => $this->order->id));
foreach($query->result() as $row)
{
$this->CI->load->library('WorkroomOrderProduct', array('row' => $row));
$p = $this->CI->workroomorderproduct;
$this->products[$p->get_product_name()][$p->get_material()->fabric][$p->get_material()->color][] = $p;
}
return $this->products;
}
The resulting array contains all identical objects though each $row iteration does have a correctly unique value.
Can I use the optional 3rd parameter of load() to pass a variable by reference thereby assigning it to that? Just naming the variable as the documentation says doesn't help - I still need a new "blank" variable each time to assign to which is why I'm thinking doing it by reference might help.