Sunday, August 30, 2009

Re: Problems with updateAll

the info was perfect, by as I said, the table doesnt have a primary
key, only a column that works like one. I cant touch it, because it
was made to work that way. Im just building 1 website for this system
I didnt make it, I know this is a terrible system ^^.
I will try to find another way. Anyway thanks for help. Cya

On 30 ago, 05:44, WebbedIT <p...@webbedit.co.uk> wrote:
> Your memb__id field must be your primary key as that is what CakePHP
> finds after running the select query and then uses to run the update.
> If you have an ID to use (which you must have as CakePHP requires all
> models to have a primary key) why are you hell bent on not using it?
> After all it would speed up your application as that's what a primary
> key is there to do.
>
> I do not know for deffinate why the dev team made the framework do the
> select query first, but I can hazard a good guess that it is there to
> ensure if only one record needs to be updated that it does not
> unneccessarily run an update call for all records in a table.  Hence
> making it more efficient and ensuring people who are misusing methods
> don't shoot themselves in the foot.
>
> >the only thing I didnt like in Cake was it. I think if it is "taken
> >off" from rails, it should works like it.
>
> I can't speak for the CakePHP development team, but I really don't
> think CakePHP is meant to be a direct copy of Ruby on Rails.  I
> believe there is a lot of influence coming from the many good things
> that RoR does, but CakePHP is its own framework and does a lot of
> things its own way.
>
> > Just one last thing, when I used this
> > $this->Account->updateAll(array('Account.bloc_code' => 0), array
> > ('Account.memb___id' => $account['Accountconfirm']['memb___id']))
> > being $account['Accountconfirm']['memb___id'] = 'mylogin'
>
> You're using the primary (memb___id) as the condition in this one, so
> it has no need to go and fetch it.  But if you have the ID and you're
> only updating one field in one record then why not use saveField() as
> previously suggested?
>
> In summary you're using the wrong method and then getting upset with
> CakePHP when it automagically steps in to help you out .. how dare it
> be so helpful :o?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: