Exemple #1
0
 public function search($params)
 {
     $query = AttributeTypesModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'is_system' => $this->is_system]);
     $query->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAttributeType()
 {
     return $this->hasOne(AttributeTypes::className(), ['id' => 'attr_type_id']);
 }
 /**
  * Finds the AttributeTypes model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param string $id
  *
  * @return AttributeTypes the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AttributeTypes::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Returns attribute types list.
  * @return array
  */
 protected function getAttributeTypes()
 {
     return ArrayHelper::map(AttributeTypes::find()->select('id, name')->asArray()->all(), 'id', 'name');
 }