public function search($params) { $query = SpecialistHasType::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['spec_id' => $this->spec_id, 'spec_type_id' => $this->spec_type_id]); return $dataProvider; }
/** * Finds the SpecialistHasType model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $spec_id * @param integer $spec_type_id * @return SpecialistHasType the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($spec_id, $spec_type_id) { if (($model = SpecialistHasType::findOne(['spec_id' => $spec_id, 'spec_type_id' => $spec_type_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getSpecialistHasTypes() { return $this->hasMany(SpecialistHasType::className(), ['spec_type_id' => 'id']); }
<h3> <?php echo $spec['last_name']; ?> <br /> <?php echo $spec['first_name']; ?> <br /> <?php echo $spec['middle_name']; ?> </h3> <p> <?php foreach ((array) SpecialistHasType::loadList('*', ['spec_id' => $spec['id']]) as $job) { ?> <?php echo $job['specType']['title']; ?> <?php } ?> </p> <p class="cost"> <?php echo $specId[0]['type']['title']; ?> <span><?php