Or faster, you may want to have a look at these snippets, that do the trick in one single request:
http://www.symfony-project.org/snippets/snippet/251 http://www.symfony-project.org/snippets/snippet/50 xavier Birchandra Sanasam a écrit : > It may help > > $obj = TablePeer::retrieveByPK($us_pk); // retrieveByPK() > is at lib/model/om/BaseTablePeer.php > $obj->setStatus($status); > //it will your field name > $obj->save(); > > On Sun, Feb 24, 2008 at 4:17 PM, Jagtesh Chadha <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hello everyone. > > I've been searching for 2 days to find a way of updating a field > throughout a table, similar to the following raw SQL query: > > UPDATE table_name > WHERE table_name.field1 = somevalue > SET table_name.field2 = someothervalue; > > My guess is there should be some criteria method to allow adding a > "SET table_name.field2 = ..." line to the query along with the > doUpdate Peer method. > > I've tried the follow, which doesn't work for obvious reasons: > $c = new Criteria(); > $c->add(TablePeer::FIELD1, somevalue); > $c->add(TablePeer::FIELD2, someothervalue); // This is where I need > help > > $res = TablePeer::doUpdate($c); > > I've looked all around for an exhaustive list of methods of the > Criteria class, but without any success. > > Any help will be greatly appreciated :-) > > > > > -- > Birchandra Sanasam > Web Developer & Analyst > # +91 9810 191478 > > -- Xavier Lacot http://www.clever-age.com Clever Age - conseil en architecture technique Tél: +33 1 53 34 66 10 Fax: +33 1 53 34 65 20 Clever Age vous invite à ses petits-déjeuners http://www.clever-age.com/actualites/petits-dejeuners/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" 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/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
