/** * Finds the Authassignment model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $item_name * @param integer $user_id * @return Authassignment the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($item_name, $user_id) { if (($model = Authassignment::findOne(['item_name' => $item_name, 'user_id' => $user_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Authassignment::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith(['itemname']); $this->load($params); $this->user_id = $params['id']; 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(['user_id' => $this->user_id, 'created_at' => $this->created_at]); $query->andFilterWhere(['like', 'item_name', $this->item_name]); $query->andFilterWhere(['LIKE', 'itemname.description', $this->getAttribute('itemname.description')]); $query->andFilterWhere(['LIKE', 'itemname.type', $this->getAttribute('itemname.type')]); $query->andFilterWhere(['LIKE', 'itemname.name', $this->getAttribute('itemname.name')]); Proc::AssignRelatedAttributes($dataProvider, ['itemname.description', 'itemname.type', 'itemname.name']); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getauthassignments() { return $this->hasMany(Authassignment::className(), ['user_id' => 'auth_user_id'])->from(['authassignments' => Authassignment::tableName()]); }
/** * @return \yii\db\ActiveQuery */ public function getauthassignments() { return $this->hasMany(Authassignment::className(), ['item_name' => 'name'])->from(['authassignments' => Authassignment::tableName()]); }