/**
  * 
  */
 public function searchUnlink($model, $params)
 {
     $query = Statuses::find()->where(['and', ['not', ['id' => $model->id]], ['doc_type' => $model->doc_type]]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'symbolic_id', $this->symbolic_id]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatusTo()
 {
     return $this->hasOne(Statuses::className(), ['id' => 'status_to']);
 }
Esempio n. 3
0
 public function getAvailableStatuses($rightIds = NULL)
 {
     return $this->hasMany(Statuses::className(), ['id' => 'status_to'])->via('statusesLinksFrom', function ($q) use($rightIds) {
         $q->andFilterWhere(['right_id' => $rightIds]);
     });
 }
 /**
  * Finds the Statuses model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Statuses the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Statuses::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('statuses', 'The requested page does not exist.'));
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatuses()
 {
     return $this->hasMany(Statuses::className(), ['doc_type' => 'id'])->indexBy('symbolic_id');
 }