1, имя модели таблицы собраний, поле идентификаторов встреч, идентификатор, время начала, созданный_байк Отношение 'MeetingParticipants' => массив (self :: HAS_MANY, 'MeetingParticipants', 'meeting_id'),
2, core_meeting_participant таблица
имя модели: meeting_participant
поля: id, meeting_id, member_id, group_id Отношения в массиве meeting_participant
'meeting' => (self :: BELONGS_TO, 'CoreMeeting' , 'meeting_id'), 'group' => array (self :: BELONGS_TO, 'MeetingGroup', 'group_id'),
3, имя модели core_meeting_group: MeetingGroup, поля: id, имя_группы
мой поисковый фильтр в модели собрания:
publi c функция поиска () {
$group=filter_var($_REQUEST['group'], FILTER_SANITIZE_STRING);//contain group name
$criteria=new CDbCriteria;
$user_id = Yii::app()->user->id;
$criteria->compare('id',$this->id);
$criteria->compare('title',$this->title,true);
$criteria->with=array('MeetingParticipants'=>array("select"=>"*"),'MeetingParticipants.group'=>array('select'=>'id,group_name'));
if(isset($this->start_time) && !empty($this->start_time))
$criteria->compare('start_time',date("Y-m-d", strtotime($this->start_time)), true);
$criteria->compare('created_by',$user_id);
if(isset($group)&&!empty($group))
$criteria->compare('group.group_name',$group);
$criteria->together = true;
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
I have created 4 meetings each metings have atleast 5 participants each participants belogns to a meeting group i want list all meetings with the following filed meeting title,groups and meeting time.
my problem is if i enable $criteria->together = true; if the meeting has more than 10 participants that will show only 1 meeting in grid view. if i disable this that will shows all but i cant search with the meeting name.
sql ссылка на скрипту http://sqlfiddle.com/#! 9 / fdaacf полный sql дамп https://pastebin.com/NtpMuCpE