Many To Many Relations User Module

Good day,

I am building many to many relationship across three tables:

User(user_id) ---- Registrations(user_id, quiz_id) ------ Quizzes(quiz_id)

User class is in user module but the rest two are under main model folder

So under User class:

I’ve put<br>

public function relations()


$relations = Yii::app()->getModule(‘user’)->relations;

if (!isset($relations[‘profile’]))

 &#036;relations['profile'] = array(self::HAS_ONE, 'Profile', 'user_id');

if (!isset($relations[‘quizzes’]))

 &#036;relations['quizzes'] = array(self::MANY_MANY, 'Quizzes', 'registrations(user_id, quiz_id)');

 return &#036;relations;


In Quizzes, I’ve put: <br>

public function relations(){



return array(

 'user' =&gt; array(self::MANY_MANY, 'User', 'registrations(quiz_id,user_id)'),



‘registrations’ is the table name in Registrations model:

public function tableName()


return ‘{{registrations}}’;


Seems I had everything done but still doesn’t work, can any one help with this please, appreciated ^^.