I follow you on $this->alias but where does $password_field come from. I'm searching everywhere to find something on this.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.On Thu, Sep 23, 2010 at 8:11 PM, Miles J <mileswjohnson@gmail.com> wrote:
$this->alias is the name of the model. If your model is User, then you
must do that on $data to get the correct value.
$data['User']['password'] is equivalent to:
$data[$this->alias][$password_field] which is the better approach
because its dynamic.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
On Sep 23, 4:59 pm, John L <confidentia...@gmail.com> wrote:
> Hello,
>
> I'm following this tutorial on the Auth component:http://bit.ly/aNWz3J
>
> I'm confused about three things and I can't figure it out on my own (trust
> me I tried).
>
> Class User extends AppModel {
>
> // ......
>
> function password_match($data, $password_field, $hashed=true) {
> $password = $this->data[$this->alias][$password_field];
> $keys = array_keys($data);
> $password_confirm = $hashed ?
> Security::hash($data[$keys[0]], null, true) :
> $data[$keys[0]];
> return $password === $password_confirm
>
> }
> }
>
> *Confusion #1: $data*
> It's my understanding that $data is a property of class Controller and it
> contains data which has been posted to the controller user HtmlHelper and
> that data here is accessible using the $this->data['ModelName']['fieldName']
> format.
>
> So why is it many times (in parameter list and in function body) that it's
> put out there simply as "$data"?
>
> *Confusion #2: $this->alias*
> What is $this->alias
>
> *Confusion #3: Where is the matching?*
> I don't see any matching.
>
> Hope you guys can help. Thank you so much.
>
> Jon Lyles
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
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:
Post a Comment