Sunday, January 2, 2011

Re: Auth component

On Jan 2, 8:13 am, gilsilas <gilsi...@gmail.com> wrote:
> Hey,
> I have two questions
> 1. when I ran $this->Auth->login($data) I noticed that the resulted
> query select user and group but by $this->Auth->user() I can see only
> the user, why is that ?
> here is the query:
> SELECT `User`.`id`, `User`.`email`, `User`.`password`,
> `User`.`group_id`, `User`.`created`, `User`.`last_login`,
> `User`.`name`, `User`.`birthday`, `User`.`gender`, `User`.`code`,
> `User`.`active`, `User`.`verify`, `Group`.`id`, `Group`.`name` FROM
> `users` AS `User` LEFT JOIN `groups` AS `Group` ON (`User`.`group_id`
> = `Group`.`id`) WHERE `User`.`email` = 'gilsi...@gmail.com' AND
> `User`.`password` = '062c8d2974c2c92b8576f816a5c3ff476b175401' AND
> `User`.`active` = 1 LIMIT 1
> 2. after my user login I update his last_login field by doing
> $this->User->id = $this->Auth->user('id');
> $this->User->saveField('last_login',date('c'));
> I noticed that this resulted two queries that are actually the same
> SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `User`.`id` =
> 1
> SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `User`.`id` =
> 1
> I don't figure out why this query should run twice by one function
> (saveField)

what makes you think both queries come from calling saveField?

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 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: