$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.

On Sep 23, 4:59 pm, John L <[email protected]> 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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