Re: Updating a User Record
On Sun, Jan 18, 2009 at 1:53 PM, Webweave wrote: > > Then you just need to set the model and tell it what the primary key > is: > > $primaryKey = "email"; > > Then $this->Administrator->id would be the the email. > > You might also need to set the Auth fields to match (I do this in my > App controller's beforeFilter): > >$this->Auth->fields = array('username' => 'user_name', > 'password' => 'user_password'); I actually tried that, but the key is that my username = primaryKey = email. For whatever reason, that just didn't work for me (it certainly could have been a misconfiguration on my part). Once I dropped a more conventional id field in there and used email just for the username everything worked okay. -- Rob Wilkerson http://robwilkerson.org --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Updating a User Record
Then you just need to set the model and tell it what the primary key is: $primaryKey = "email"; Then $this->Administrator->id would be the the email. You might also need to set the Auth fields to match (I do this in my App controller's beforeFilter): $this->Auth->fields = array('username' => 'user_name', 'password' => 'user_password'); On Jan 13, 1:09 pm, "Rob Wilkerson" wrote: > On Tue, Jan 13, 2009 at 3:28 PM, Miles J wrote: > > You have to set the id first, in your case it might be: > > > $this->Administrator->id = $this->Auth->user('id'); > > $this->Administrator->save($data); > > Therein, as they say, lies the rub. I don't have an id field in my > administrators table. I use email for the Auth username and that's > also the primary key on the table. I've already tried setting > $this->Administrator->email, but Cake didn't handle it as a primary > key and tried to insert the record. I tried telling the model that the > email field was it's $primaryKey, but that screwed up authentication. > > Am I trying to push the envelope too far? Sounds like I can make all > of this work out by adding a "traditional" primary key so is that the > right way to go (read: the way I should've gone in the first place)? > > Thanks again. > > -- > Rob Wilkersonhttp://robwilkerson.org --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Updating a User Record
On Tue, Jan 13, 2009 at 4:57 PM, Miles J wrote: > > Well its easiest to have an id field. > > But your right, you would set the primary key. And if that breaks > auth, change the fields for the auth. > > http://book.cakephp.org/view/390/fields Thanks. The latter is what I've already done, so I guess I'll add an id field and move on. -- Rob Wilkerson http://robwilkerson.org --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Updating a User Record
Well its easiest to have an id field. But your right, you would set the primary key. And if that breaks auth, change the fields for the auth. http://book.cakephp.org/view/390/fields --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Updating a User Record
On Tue, Jan 13, 2009 at 3:28 PM, Miles J wrote: > You have to set the id first, in your case it might be: > > $this->Administrator->id = $this->Auth->user('id'); > $this->Administrator->save($data); Therein, as they say, lies the rub. I don't have an id field in my administrators table. I use email for the Auth username and that's also the primary key on the table. I've already tried setting $this->Administrator->email, but Cake didn't handle it as a primary key and tried to insert the record. I tried telling the model that the email field was it's $primaryKey, but that screwed up authentication. Am I trying to push the envelope too far? Sounds like I can make all of this work out by adding a "traditional" primary key so is that the right way to go (read: the way I should've gone in the first place)? Thanks again. -- Rob Wilkerson http://robwilkerson.org --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Updating a User Record
You have to set the id first, in your case it might be: $this->Administrator->id = $this->Auth->user('id'); $this->Administrator->save($data); --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---