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" <r...@robwilkerson.org> wrote:
> On Tue, Jan 13, 2009 at 3:28 PM, Miles J <mileswjohn...@gmail.com> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to