Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on self joined model #15

Open
sohambanik opened this issue May 20, 2014 · 0 comments
Open

Not working on self joined model #15

sohambanik opened this issue May 20, 2014 · 0 comments

Comments

@sohambanik
Copy link

My User model is like this:

class User extends AppModel {
public $actsAs = array('Containable', 'HabtmCounterCache');

public $hasAndBelongsToMany = array(
    'Follower' => array(
        'className' => 'User',
        'joinTable' => 'relationships',
        'foreignKey' => 'followed_id',
        'associationForeignKey' => 'follower_id',
        'unique' => 'true' // If you do not want records to be deleted
    ),
    'Following' => array(
        'className' => 'User',
        'joinTable' => 'relationships',
        'foreignKey' => 'follower_id',
        'associationForeignKey' => 'followed_id',
        'unique' => 'true' // If you do not want records to be deleted
    )
);

I have added two columns namely follwer_count and following_count at user model. But its not updating the counter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant