Re: hasMany multi-row save problem

2007-04-27 Thread Jon Bennett
> It looks like your error mess sage will only show if the save on the > *last* order_detail fails, since $result is reset with each iteration > of the loop. This action probably should use transaction processing > (commit/rollback support). it was just off-the-cuff code, merely meant to give an i

Re: hasMany multi-row save problem

2007-04-27 Thread NOSLOW
It looks like your error message will only show if the save on the *last* order_detail fails, since $result is reset with each iteration of the loop. This action probably should use transaction processing (commit/rollback support). Also, instead of setting the id field to null in each iteration,

Re: hasMany multi-row save problem

2007-04-26 Thread Jon Bennett
sorry, it´s very early here, I meant: if($this->Order->save($this->data)) { $order_id = $this->Order->getLastInsertId(); foreach ($this->data[´OrderDetail´] as $order_detail) { $data = array(); $data[´OrderDetail´][íd´] = null;

Re: hasMany multi-row save problem

2007-04-26 Thread Jon Bennett
hasMany´s are not saved automagically, try: if($this->Order->save($this->data)) { $order_id = $this->Order->getLastInsertId(); foreach ($this->data[´OrderDetail´] as $order_detail) { $data = array(); $data[´OrderDetail´][íd´] = null;

hasMany multi-row save problem

2007-04-26 Thread cc96ai
I create the following structure of the data, I am able to save Order Table, however I m still unable to save Orderdetail --- Array ( [Order] => Array ( [customer_id] => 1 [user_id] => 11 ) [Orderdetail] => Array (