Пример #1
0
 /**
  * Yield a list of all available currencies
  */
 public function listCurrencies()
 {
     return Currency::find()->indexBy('id')->all();
     if (!empty($currency)) {
         return ArrayHelper::map($currency, 'id', 'name');
     }
     return [];
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Currency::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(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'full_name', $this->full_name]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCurrency()
 {
     return $this->hasOne(Currency::className(), ['id' => 'curr_id']);
 }
Пример #4
0
 public function getCurrencyObj()
 {
     return $this->hasOne(Currency::className(), ['id' => 'curr_id'])->via('currencyLink');
 }