/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DcmdAppArchDiagram::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'app_id' => $this->app_id, 'utime' => $this->utime, 'ctime' => $this->ctime, 'opr_uid' => $this->opr_uid]);
     $query->andFilterWhere(['like', 'arch_name', $this->arch_name])->andFilterWhere(['like', 'diagram', $this->diagram])->andFilterWhere(['like', 'comment', $this->comment]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 private function deleteDiagram($id)
 {
     $query = DcmdAppArchDiagram::find()->andWhere(['app_id' => $id])->asArray()->all();
     foreach ($query as $item) {
         ///删除文件
         $base_path = dirname(__DIR__) . "/web/app_image/app_";
         $img_path = $base_path . $item['arch_name'] . '_' . $id . '.jpg';
         if (file_exists($img_path)) {
             unlink($img_path);
         }
     }
     DcmdAppArchDiagram::deleteAll(['app_id' => $id]);
 }
 /**
  * Finds the DcmdAppArchDiagram model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return DcmdAppArchDiagram the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DcmdAppArchDiagram::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }