I have 2 tables
In my first table I have student_id, user_id columns,
In Contract table I have contract_id and student_id as foreign key.
Now in contract/index I want to display only that student_id for users that are related in studentHasUser table.
for example in my StudentHasUser table I only show students for user that is logged:
$current_id = Yii::app()->user->getId(); $dataProvider=new CActiveDataProvider('StudentHasUser', array( 'criteria'=>array( 'condition'=>'user_userId='.$current_id, 'order'=>student_studentId DESC', ) ));
Now how I can restrict display contract for users that are in same column with students. How should I select it ?