Hello all,
I'm getting something strange with HABTM relations. I follow
instruction from here:
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/
Now, two examples:
When I'm creating new Product this works perfect:
$this->Product->bindModel(array('hasMany' =>
array('CategoriesProduct')));
$this->Product->saveAll($this->data)
Debug for $this->data:
Array
(
[Product] => Array
(
[name] => ddd
[description] =>
[price] => 5.00
[special_price] => 6.00
[quantity] => 7
[weight] => 10.00
[active] => 1
)
[CategoriesProduct] => Array
(
[0] => Array
(
[category_id] => 2
[quantity] => 55
[price] => 10.00
)
)
)
But when I'm updating existing Product with same code I'm getting:
Notice (8): Undefined index: CategoriesProduct [CORE/cake/libs/model/
model.php, line 1425]
Model::saveAll() - CORE/cake/libs/model/model.php, line 1425
ProductsController::manager_edit() - APP/controllers/
products_controller.php, line 140
The debug for $this->data (the difference is of course that here is
defined id for Product):
Array
(
[Product] => Array
(
[id] => 3
[name] => ddd
[description] =>
[price] => 5.00
[special_price] => 6.00
[quantity] => 7
[weight] => 10.00
[active] => 1
)
[CategoriesProduct] => Array
(
[0] => Array
(
[category_id] => 2
[quantity] => 55
[price] => 10.00
)
)
)
What I'm missing? Help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---