You can try this:
$user = $this->find('first', array(
'conditions' => array('username' => $data['username'], 'password' => md5
($data['password'])),
'fields' => array('user_id', 'username'),
'recursive' => -1)
);
[]'s
On Feb 11, 2008 10:58 PM, adammc84 <[EMAIL PROTECTED]> wrote:
>
> Can anybody help me out and tell me what i am doing wrong.
>
> I am using cake 1.2
>
> when i use pr( $user ) to view the data returned from a find call on
> my Model 'User', i receive data from 'ActiveUser' Model - which i
> would expect BUT i have set recursive to -1 in the 'find' call.
>
> MySql database
>
> Table 'users' PrimaryKey = user_id
> Table 'active_users' PrimaryKey = user_id, d_id
>
> users 0..N entry's in active_users table
>
> CakePHP
>
> models/user.php
> view here -> http://bin.cakephp.org/view/1197815829
>
> models/activeuser.php
> view here ->
> http://bin.cakephp.org/view/1501988477
>
> *i call pr($user) in the user.php Model validateLogin() method.
>
> i receive the following * i don't want 'ActiveUser' data only 'User'
> thats why i have set recursive to -1 in the find call
>
> *note that i use 'ActiveUser' in other parts in the application, i
> need to limit the data returned for the Auth component and i don't
> understand what i am doing wrong
>
> Thanks
>
> -------------------------------------------------------------------
> I GET THIS
>
> Array
> (
> [User] => Array
> (
> [user_id] => 133
> [username] => [EMAIL PROTECTED]
> )
>
> [ActiveUser] => Array
> (
> [0] => Array
> (
> [last_activity] => 0000-00-00 00:00:00
> [user_id] => 142
> [d_id] => bff24d0c3cdfc3d8592501cfb712df98
> )
>
> [1] => Array
> (
> [last_activity] => 2008-01-27 15:31:34
> [user_id] => 142
> [d_id] => faa4069119f9bf64f33ba3e6fc21eaf2
> )
>
> )
>
> )
>
> -----------------------------------------------------------------
>
> I WANT THIS
>
> Array
> (
> [User] => Array
> (
> [user_id] => 133
> [username] => [EMAIL PROTECTED]
> )
> )
>
> >
>
--
Renan Gonçalves - Software Engineer
Cell Phone: +55 (11) 8633-6018
MSN: [EMAIL PROTECTED]
Web Site: renangoncalves.com
São Paulo - SP/Brazil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---