Tuesday, June 30, 2009

Inserting record with id

Hi,

i have a table products with the following columns ( simplified )

id
shop_id
name

id and shop_id are the primary key.

Now I have some kind of importer and want to insert data preparing my array like

$i['Product']['id'] = $id;
$i['
Product']['shop_id'] = $shop_id;
$i['
Product']['name'] = $name;

App::import('Model', 'Product' );
$Product = new Product();
$Product->save($i);

But it does not save the id, only shop_id and name. I tried to add a fieldList to the save function, but it didn't work.

Any help? Thanks for your hints.
Roman

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: