コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Documenttype::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(['DocumentTypeId' => $this->DocumentTypeId, 'TopicTypeId' => $this->TopicTypeId]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Color', $this->Color]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the Documenttype model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Documenttype the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Documenttype::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: Document.php プロジェクト: KarimMagdi87/adala2
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDocumentType()
 {
     return $this->hasOne(Documenttype::className(), ['DocumentTypeId' => 'DocumentTypeId']);
 }
コード例 #4
0
ファイル: Topictype.php プロジェクト: KarimMagdi87/adala2
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDocumenttypes()
 {
     return $this->hasMany(Documenttype::className(), ['TopicTypeId' => 'TopicTypeId']);
 }
コード例 #5
0
 public function actionComponents($id)
 {
     // $documnttypeId  =  Yii::$app->getRequest()->getQueryParam($id);
     //echo $id;
     $documentTypeName = Documenttype::find()->where("documenttypeid=" . $id)->one();
     //print_r($documentTypeName);
     $sql = 'SELECT * FROM topic WHERE topicid IN (SELECT topicid FROM documenttypetopic WHERE documenttypeid = ' . $id . ')';
     $data = Topic::findBySql($sql)->all();
     // print_r($data); exit;
     return $this->render('components', array('topic' => $data, 'documentTypeName' => $documentTypeName));
 }
コード例 #6
0
ファイル: Topic.php プロジェクト: KarimMagdi87/adala2
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDocumentTypes()
 {
     return $this->hasMany(Documenttype::className(), ['DocumentTypeId' => 'DocumentTypeId'])->viaTable('documenttypetopic', ['TopicId' => 'TopicId']);
 }