public function obtenTimeAgenda($groupid, $professor) { $retorno = array(); $retorno['agenda'] = Acdschedule::find()->joinWith(['acdscheduleprofessors'])->andwhere(['groupid' => $groupid])->andwhere(['acdscheduleprofessor.professorid' => $professor])->orderBy('groupid')->all(); $times = array(); foreach ($retorno['agenda'] as $str) { $str->timeids = str_replace('{', '', $str->timeids); $str->timeids = str_replace('}', '', $str->timeids); $timeAux = split(',', $str->timeids); $times = array_merge($times, $timeAux); } $retorno['timeData'] = Acdtime::find()->where(['in', 'timeid', $times])->all(); return $retorno; }
/** * @return \yii\db\ActiveQuery */ public function getTime() { return $this->hasOne(Acdtime::className(), ['timeid' => 'timeid']); }