예제 #1
0
 public function actionMbMemberships()
 {
     $currUser = Yii::$app->user->getIdentity();
     $currMb = MerchantBrand::find()->where(['merchant_brand_id' => $currUser->username])->one();
     $mbFk = $currMb->_id;
     $query = Membership::find()->where(['merchant_brand_fk' => new \MongoId($mbFk)]);
     $searchModel = new MembershipSearch();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MerchantBrand::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pagesize' => 10]]);
     $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(['like', '_id', $this->_id])->andFilterWhere(['like', 'merchant_brand_id', $this->merchant_brand_id])->andFilterWhere(['like', 'merchant_brand_name1', $this->merchant_brand_name1])->andFilterWhere(['like', 'merchant_brand_name2', $this->merchant_brand_name2])->andFilterWhere(['like', 'merchant_brand_tag', $this->merchant_brand_tag])->andFilterWhere(['like', 'merchant_brand_url', $this->merchant_brand_url])->andFilterWhere(['like', 'merchant_brand_official_url', $this->merchant_brand_official_url])->andFilterWhere(['like', 'merchant_brand_email', $this->merchant_brand_email])->andFilterWhere(['like', 'merchant_brand_logo_img', $this->merchant_brand_logo_img])->andFilterWhere(['like', 'merchant_brand_logo_img_mobile', $this->merchant_brand_logo_img_mobile])->andFilterWhere(['like', 'merchant_brand_search_keywords', $this->merchant_brand_search_keywords])->andFilterWhere(['like', 'merchant_brand_create_date', $this->merchant_brand_create_date])->andFilterWhere(['like', 'merchant_brand_create_user_id', $this->merchant_brand_create_user_id])->andFilterWhere(['like', 'merchant_brand_last_update_date', $this->merchant_brand_last_update_date])->andFilterWhere(['like', 'merchant_brand_last_update_user_id', $this->merchant_brand_last_update_user_id])->andFilterWhere(['like', 'merchant_brand_status', $this->merchant_brand_status]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Creates a new Product model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $currUser = Yii::$app->user->getIdentity();
     $currMb = MerchantBrand::find()->where(['merchant_brand_id' => $currUser->username])->one();
     $mbFk = $currMb->_id;
     $model = new Product();
     $model->merchant_brand_fk = $mbFk;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => (string) $model->_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
예제 #4
0
파일: User.php 프로젝트: chimgrrl/auction
 public function getMerchantBrand()
 {
     return $this->hasOne(MerchantBrand::className(), ['user_fk' => 'id']);
 }
예제 #5
0
 public function getMerchantBrand()
 {
     return $this->hasOne(MerchantBrand::className(), ['_id' => 'merchant_brand_fk']);
 }
예제 #6
0
 /**
  * Finds the MerchantBrand model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $_id
  * @return MerchantBrand the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MerchantBrand::findOne($id)) !== null) {
         $model->merchant_brand_search_keywords = implode(", ", $model->merchant_brand_search_keywords);
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }