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; }
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 []; } }
/** * @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(); }
/** * 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.'); } }
protected function setSubData() { $this->subData['usersData'] = $this->module->getUsersArray(); $this->subData['orderStatuses'] = OrderStatus::getOrderStatusArray(); $this->subData['orderAttributes'] = OrderAttribute::getAttributesArray(); $this->subData['storeGroups'] = StoreGroup::getStoreGroupsArray(); }
/** * @return array [[DropDownList]] */ public function getOrderAttributes($w_s = true) { return OrderAttribute::getAttributesArray($w_s); }