Advertisement
Guest User

Untitled

a guest
May 26th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. public function initialize(array $config)
  2.     {
  3.         parent::initialize($config);
  4.  
  5.         $this->setTable('followers');
  6.         $this->setDisplayField('id');
  7.         $this->setPrimaryKey('id');
  8.  
  9.         $this->addBehavior('Timestamp');
  10.  
  11.         $this->belongsTo('Followers', [
  12.             'className' => 'Users',
  13.             'joinTable' => 'Users',
  14.             'foreignKey' => 'follower_id',
  15.             'joinType' => 'INNER'
  16.         ]);
  17.         $this->belongsTo('Users', [
  18.             'foreignKey' => 'user_id',
  19.             'joinType' => 'INNER'
  20.         ]);
  21.         $this->hasMany('Followers', [
  22.             'foreignKey' => 'follower_id'
  23.         ]);
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement