コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     //$query = REFERRALGIVEN::find();
     $query = REFERRALGIVEN::find()->joinWith(['rEFERRAL']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     /**
      * Setup your sorting attributes
      * Note: This is setup before the $this->load($params) 
      * statement below
      */
     $dataProvider->setSort(['attributes' => ['GIVEN_ID', 'MEMBER_ID', 'referralName' => ['asc' => ['REFERRAL.REFERRAL_NAME' => SORT_ASC], 'desc' => ['REFERRAL.REFERRAL_NAME' => SORT_DESC], 'label' => 'Referral Name'], 'MEETING_ID']]);
     if (!($this->load($params) && $this->validate())) {
         //Brad
         //$query->joinWith(['rEFERRAL']);
         return $dataProvider;
     }
     $query->andFilterWhere(['GIVEN_ID' => $this->GIVEN_ID, 'MEMBER_ID' => $this->MEMBER_ID, 'REFERRAL_ID' => $this->REFERRAL_ID, 'MEETING_ID' => $this->MEETING_ID]);
     $query->andFilterWhere(['like', 'GIVEN_YOUR_CARD', $this->GIVEN_YOUR_CARD])->andFilterWhere(['like', 'TOLD_THEM_YOU_WOULD_CALL', $this->TOLD_THEM_YOU_WOULD_CALL])->andFilterWhere(['like', 'COMMENTS', $this->COMMENTS]);
     // filter by Referral name - Brad
     //        $query->joinWith(['rEFERRAL'=>function ($q) {
     //            $q->where('rEFERRAL.REFERRAL_NAME LIKE "%' .
     //                $this->referralName . '%"');
     //        }]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getREFERRALGIVENs()
 {
     return $this->hasMany(REFERRALGIVEN::className(), ['MEETING_ID' => 'MEETING_ID']);
 }
コード例 #3
0
 /**
  * Finds the REFERRALGIVEN model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return REFERRALGIVEN the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = REFERRALGIVEN::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }