Thanks grigri!

But, it seems like I shouldn't be using the Model.field format,
neither cakebaker nor nate are using it in their working examples (see
the last comment on the ticked you posted). I'm using the latest
nightly, if that matters at all.

On Mar 26, 12:14 pm, grigri <[EMAIL PROTECTED]> wrote:
> It's as easy as :
>
> $Model->updateAll(array('Model.hitfield' => 'Model.hitfield +1'),
> array('Model.keyfield' => '= ' . $key));
>
> Note that in some versions the updateAll does a join on hasOne/
> belongsTo so you have to specify the fields in Model.field format, not
> just the field name.
>
> See:
>
> http://cakebaker.42dh.com/2007/12/12/a-black-sheep-with-the-name-mode...https://trac.cakephp.org/ticket/1976
>
> On Mar 26, 11:06 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]>
> wrote:
>
> > I've searched and I've searched, I see people mentioning it, but I'm
> > not really sure how to increment the value of 'hitField'? How do I
> > tell updateAll to add one to the existing value?
>
> > Thanks in advance!
>
> > On Mar 26, 11:35 am, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > > $Model->updateAll();
>
> > > Cheers,
> > > Adam
>
> > > On Mar 26, 8:17 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi everyone,
>
> > > > I'm working on a behaviour, and I'm currently running my query like
> > > > this:
>
> > > > $Model->query(
> > > >                         'UPDATE '.$Model->table.'
> > > >                         SET             '.$_settings['hitField'].' =
> > > >                                                 
> > > > '.$_settings['hitField'].' + 1
> > > >                         WHERE   '.$_settings['keyField'].' = '.$key.';'
> > > >                         );
>
> > > > But this doesn't seem "Cakeish" enough, is there a better way to run
> > > > the same query?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to