Monday, September 5, 2011

Fetch Related Data

I have a user and a profile table in my a cakephp application I am
developing. In my model files my User Model a user hasOne profile and
in my Profile Model a profile belongsTo a user.

I am using the user table to validate a user login.
In my profile table there is a user_id field containing the id of the
user in the user table.

But the problem I am having is that is it possible to fetch a user
profile after he login based on the user_id field in the profile table
and not using the id field in the user table.

Would like to know how to do this, or is there a way for me to fetch
all a User data from other table using the value of the user_id in the
other table.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: