Reputation: 397
I have to use this :
$deleted = Doctrine_Query::create()
->delete()
->from('orders')
->andWhere('user_id = "'.$_REQUEST["user_id"].'"')
->execute();
to delete a line from SQL in symfony, but how can I create a new line with this rows:
id|user_id|order_date|order_type|order_end_date|aktiv|fiz_meth
the name of table is: orders
How can I do that?
Upvotes: 0
Views: 2941
Reputation: 22756
You should create a new order using this kind of code:
$orders = new Orders();
$orders->set('id', $id); // maybe you don't need this line, if `id` is the primary key
$orders->set('user_id', $user_id);
$orders->set('order_date', $order_date);
$orders->set('order_type', $order_type);
$orders->set('order_end_date', $order_end_date);
$orders->set('aktiv', $aktiv);
$orders->set('fiz_meth', $fiz_meth);
$orders->save();
Be sure to replace variable name for each column.
You will find an other example on the second code bloc in the official doc.
Upvotes: 1