Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PhonesPerson::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['phone_person_id' => $this->phone_person_id, 'person_id' => $this->person_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'number', $this->number]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhonePerson()
 {
     return $this->hasOne(PhonesPerson::className(), ['phone_person_id' => 'phone_person_id']);
 }
Exemplo n.º 3
0
 /**
  * Finds the PhonesPerson model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PhonesPerson the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PhonesPerson::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPhonesPeople()
 {
     return $this->hasMany(PhonesPerson::className(), ['person_id' => 'person_id']);
 }