On Sat, Jul 17, 2010 at 7:06 AM, Daniel M.K. <[email protected]> wrote:
> Each user that register will have a premade profile inserted into de
> DB already. At the moment i have the hasOne relationship, when user
> registers it creates a profile, and it assigns a user ID to that
> profile, the script i use now is:
>
> function register() {
> if(!empty($this->data)) {
> //Saver User data
>
> $user = $this->User->save($this->data);
>
> if(!empty($user)) {
> $this->data['Profile']['user_id'] = $this->User-
>>id;
>
> $this->User->Profile->save($this->data);
>
> --------------------------
>
> This script works, now what i want to do is to search in the profiles
> table for the profile that is already inserted. For this, user will
> insert an E-Mail, First Name, Last Name and maybe other fields more to
> verify that it is his profile and assign it to him. There are no
> profile templates, there are profiles with data inserted already!.
This seems like a strange setup to me. Why do you have a Profile
record before the User is even registered?
In any case, you'll obviously need to have the value of at least one
column in the profiles table that is unique to this User.
$data = $this->User->Profile->find(
'first',
array(
'conditions' => array(
'Profile.email' => $email
)
)
);
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