$dataProvider=new CActiveDataProvider('EventParticipant', array(
'criteria'=>array('condition'=>'status_id=:status AND participant_level_id=:participantLevel AND event.contact_id=:PRG',
'params' =>array( ':status'=>1,
':participantLevel'=>1,
':PRG'=>$PrgID),
'order'=>'event_id',
'with'=>array('event','participant')
),
'pagination'=>array('pageSize'=>self::PAGE_SIZE),
));
This is just a cut/paste of my code hopefully it helps you out. In my case all of the items are in the many/many table ‘EventParticipant’
EventParticipant relations
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'participant' => array(self::BELONGS_TO,
'Participant',
'participant_id',
),
'event' => array(self::BELONGS_TO,
'Event',
'event_id',
'joinType'=>'INNER JOIN',
),
'status' => array(self::BELONGS_TO, 'Status', 'status_id'),
'participant_level' => array(self::BELONGS_TO, 'ParticipantLevel', 'participant_level_id'),
'payment_method' => array(self::BELONGS_TO, 'PaymentMethods', 'paymentMethods_id'),
);
}
Event model relations
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'contact' => array(self::BELONGS_TO, 'Participant', 'contact_id'),
'event_type' => array(self::BELONGS_TO, 'EventType', 'event_type_id'),
'event_location' => array(self::BELONGS_TO, 'EventLocations', 'event_location_id'),
'event_status' => array(self::BELONGS_TO, 'EventStatus', 'event_status_id'),
'eventParticipants' => array(self::HAS_MANY, 'EventParticipant', 'event_id'),
'eventThemes' => array(self::HAS_MANY, 'EventTheme', 'event_id'),
);
}
participant relations
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'donations' => array(self::HAS_MANY, 'Donation', 'participant_id'),
'events' => array(self::HAS_MANY, 'Event', 'contact_id'),
'eventParticipants' => array(self::HAS_MANY, 'EventParticipant', 'participant_id'),
'gender' => array(self::BELONGS_TO, 'Gender', 'gender_id'),
'lodgingtype' => array(self::BELONGS_TO, 'LodgingType', 'lodgingtype_id'),
'participantCreditCards' => array(self::HAS_MANY, 'ParticipantCreditCard', 'participant_id'),
'participantFoodHealths' => array(self::HAS_MANY, 'ParticipantFoodHealth', 'participant_id'),
'users' => array(self::HAS_MANY, 'Users', 'participant_id'),
'participantLevel'=>array(self::MANY_MANY, 'ParticipantLevel', 'EventParticipant(participant_id, participant_level_id)'),
);
}
doodle