I'm wondering how can I add attributes, that are not declared in a class, into an object.
Let me explain :
I have my order :
 [0] => stdClass Object
( 
   [quantityBlack] => 3
   [quantityBlue] => 1
   [quantityGreen] => 0
   [quantityOrange] => 0
   [quantityPurple] => 0
   [quantityRed] => 0
   [dateOfOrder] => Fri, 06 Jul 12 22:21
   [user_id] => 5
   [comments] => Test
)
and I would like to replace the user_id by the attributes of the user,
so what I would like to do is :
foreach ($data['orders'] as $key => $order){
        $data['orders']->$key???-> = $this->user_model->GetUsers(array('userId' => $order->user_id));
    }
but I don't know how to specifically target a single object (you see the key???) at the end, I would like to get the attributes of the related user to that order.
How can I do that ?
Thank You !
 
     
    