I am trying to implement a similar feature, but am not sure how 
to propagate data in the tables. The follower is one of the ther user from 
the user table only. So it dosn't makes much sense to me , to maintain 
follow table with details of the user. rather it will be better that i can 
save the respective user_id's in the followed and follower column, will it 
be possible by HABTM or Join model.???

On Wednesday, June 13, 2012 10:53:56 AM UTC+5:30, Karey Powell wrote:
>
> It can be done easily with a HABTM relationship. For example, 
>
> Table Users:
>   - id
>   - name
>   - email
>
> Table Followers
>   - id
>   - name
>   - email
>
> and then to create the HABTM relationship, all you have to do is create an 
> association table to join Users and Followed_Users.
>
> Table Followed_Users
>   - id
>   - user_id
>   - follower_id
>
> and make them both UNIQUE KEY ` user_id ` (` user_id `,` follower_id `). 
> This should do the trick. You don't have to worry about the relationships 
> when deleting a record, Cake already takes care of it by setting 
> the 'unique' => 'keepExisting' in the association of the Model.
>

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to