You realized that your update code only get executed upon saving new record? It's because of: "if($this->isNew())"
On Mon, Sep 14, 2009 at 10:10 PM, HAUSa <jeroen_heeft_behoefte_aan_r...@hotmail.com> wrote: > > My thought as well, but however it should be executed! > When I create a new record, the last piece of code ($this->setRank(1)) > is executed, all new records have '1' as rank value. > > > On 14 sep, 01:00, Sid Bachtiar <sid.bacht...@gmail.com> wrote: >> If it doesn't show up and there's no error, it is possible that the >> piece of code isn't executed at all. >> >> On Mon, Sep 14, 2009 at 10:19 AM, HAUSa >> >> >> >> <jeroen_heeft_behoefte_aan_r...@hotmail.com> wrote: >> >> > Hmm... that query is not found in the controlpanel_dev.log... >> >> > sep 14 00:13:20 symfony [info] {estateActions} Call "estateActions- >> >>executeCreate()" >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} exec: SET NAMES >> > 'utf8' >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} prepare: INSERT INTO >> > estate >> > (`ID`,`TITLE`,`SLUG`,`TYPE`,`SURFACE`,`PRICE`,`INTRODUCTION`,`DESCRIPTION`,`AVAILABLE`,`ATTENTION`,`RANK`) >> > VALUES (:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:p11) >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding NULL at >> > position :p1 w/ PDO type PDO::PARAM_NULL >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 'Test 6' at >> > position :p2 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 'test-6' at >> > position :p3 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 'buy' at >> > position :p4 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 105 at >> > position :p5 w/ PDO type PDO::PARAM_INT >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 1200.5 at >> > position :p6 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 'fadsf adg' >> > at position :p7 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding '' at >> > position :p8 w/ PDO type PDO::PARAM_STR >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 1 at >> > position :p9 w/ PDO type PDO::PARAM_INT >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 0 at >> > position :p10 w/ PDO type PDO::PARAM_INT >> > sep 14 00:13:20 symfony [debug] {sfPropelLogger} Binding 1 at >> > position :p11 w/ PDO type PDO::PARAM_INT >> > sep 14 00:13:21 symfony [info] {sfFrontWebController} Redirect to >> > "http://controlpanel.dev.benvermeergroep.nl/index.php/estate/new" >> >> > This query should be executed on save: >> > public function save(PropelPDO $oCon = null){ >> >> > if($this->isNew()){ >> > $oConnection = Propel::getConnection(); >> >> > $oSelectCriteria = new Criteria(); >> >> > $oUpdateCriteria = new Criteria(); >> > $oUpdateCriteria->add(EstatePeer::RANK, '5'); >> >> > BasePeer::doUpdate($oSelectCriteria, $oUpdateCriteria, >> > $oConnection); >> >> > $this->setRank(1); >> > } >> >> > return parent::save($oCon); >> >> > } >> >> > On 14 sep, 00:07, Sid Bachtiar <sid.bacht...@gmail.com> wrote: >> >> What's the SQL query in the debug log? >> >> >> On Mon, Sep 14, 2009 at 10:03 AM, HAUSa >> >> >> <jeroen_heeft_behoefte_aan_r...@hotmail.com> wrote: >> >> >> > No... >> >> >> > On 13 sep, 23:53, Sid Bachtiar <sid.bacht...@gmail.com> wrote: >> >> >> Did you get any error message? >> >> >> >> On Mon, Sep 14, 2009 at 9:44 AM, HAUSa >> >> >> >> <jeroen_heeft_behoefte_aan_r...@hotmail.com> wrote: >> >> >> >> > I tried that, that was my "helas no difference" answer. >> >> >> > But besides that, I also tried the '5' instead of 'rank=rank+1' >> >> >> > update, but also that didn't work. >> >> >> >> > My code now: >> >> >> > $oConnection = Propel::getConnection(); >> >> >> >> > $oSelectCriteria = new Criteria(); >> >> >> >> > $oUpdateCriteria = new Criteria(); >> >> >> > $oUpdateCriteria->add(EstatePeer::RANK, '5'); >> >> >> >> > BasePeer::doUpdate($oSelectCriteria, $oUpdateCriteria, $oConnection); >> >> >> >> > On 13 sep, 23:35, Gábor Fási <maerl...@gmail.com> wrote: >> >> >> >> This criteria means: all records, that have a star as their ID. Try >> >> >> >> Sid's modification, so an empty criteria, that means all records. >> >> >> >> >> On Sun, Sep 13, 2009 at 23:14, HAUSa >> >> >> >> >> <jeroen_heeft_behoefte_aan_r...@hotmail.com> wrote: >> >> >> >> > $oSelectCriteria->add(EstatePeer::ID, '*'); //all records >> >> >> >> -- >> >> >> Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz >> >> >> -- >> >> Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz >> >> -- >> Blue Horn Ltd - System Developmenthttp://bluehorn.co.nz > > > -- Blue Horn Ltd - System Development http://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 symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---