Thanks for you quick replies! But, helas, it doesn't work for me. I don't get an error, but the query is just not executed. Or the query is built in a way that doesn't have any effect.
This is my code: $oConnection = Propel::getConnection(); $oSelectCriteria = new Criteria(); $oSelectCriteria->add(EstatePeer::ID, '*'); //all records $oUpdateCriteria = new Criteria(); $oUpdateCriteria->add(EstatePeer::RANK, 'rank=rank+1', Criteria::CUSTOM_EQUAL); // rank goes 1 up BasePeer::doUpdate($oSelectCriteria, $oUpdateCriteria, $oConnection); On 13 sep, 22:46, Sid Bachtiar <[email protected]> wrote: > This might help > > http://snippets.symfony-project.org/snippet/50 > > On Mon, Sep 14, 2009 at 8:44 AM, HAUSa > > > > <[email protected]> wrote: > > > Is there a fast way to update all records matching a criteria? > > > What I could do, is this: > > $results = MyPeer::doSelect(new Criteria()); > > foreach($results as $result){ > > $result->setValue('new'); > > $result->save(); > > } > > > But that executes many database requests. Is there a way to execute > > this query: > > UPDATE mytable SET value='new' > > -- > Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
