コード例 #1
0
 public function search($params)
 {
     $query = OrderAttribute::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['assignment' => $this->assignment]);
     $query->andFilterWhere(['like', 'attribute_name', $this->attribute_name]);
     return $dataProvider;
 }
コード例 #2
0
 public function getOrderAttributes($assignment = 'all')
 {
     if ($assignment == 'all') {
         $order_attributes = OrderAttribute::find()->asArray()->all();
     } elseif ($assignment == 'user') {
         $order_attributes = OrderAttribute::find()->user()->asArray()->all();
     } elseif ($assignment == 'system') {
         $order_attributes = OrderAttribute::find()->system()->asArray()->all();
     }
     if ($order_attributes !== null) {
         return ArrayHelper::getColumn($order_attributes, 'attribute_name');
     } else {
         return [];
     }
 }
コード例 #3
0
ファイル: Store.php プロジェクト: sap55/yii2-order-management
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrderTemplate()
 {
     return $this->hasMany(OrderAttribute::className(), ['attribute_name' => 'attribute_name'])->viaTable('order_attribute_to_store', ['store_id' => 'store_id'])->asArray();
 }
コード例 #4
0
 /**
  * Finds the OrderAttribute model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return OrderAttribute the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($attribute_name)
 {
     if (($model = OrderAttribute::findOne($attribute_name)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
コード例 #5
0
 protected function setSubData()
 {
     $this->subData['usersData'] = $this->module->getUsersArray();
     $this->subData['orderStatuses'] = OrderStatus::getOrderStatusArray();
     $this->subData['orderAttributes'] = OrderAttribute::getAttributesArray();
     $this->subData['storeGroups'] = StoreGroup::getStoreGroupsArray();
 }
コード例 #6
0
 /**
  * @return array [[DropDownList]]
  */
 public function getOrderAttributes($w_s = true)
 {
     return OrderAttribute::getAttributesArray($w_s);
 }