> 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
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,
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;
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;
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
(