|
|
@@ -77,7 +77,7 @@ class Countries extends \common\components\ActiveRecord
|
|
|
*/
|
|
|
public static function getAllData()
|
|
|
{
|
|
|
- return static::find()->where('ACTIVE=1')->orderBy('ACTIVE DESC, NAME ASC')->asArray()->all();
|
|
|
+ return static::find()->with('currency')->where('ACTIVE=1')->orderBy('ACTIVE DESC, NAME ASC')->asArray()->all();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -112,4 +112,13 @@ class Countries extends \common\components\ActiveRecord
|
|
|
$record = self::findOneAsArray('ID=:ID', [':ID' => $id]);
|
|
|
return $record['LOCAL_CURRENCY_ID'] ?? 0;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关联currency.
|
|
|
+ * @return \yii\db\ActiveQuery
|
|
|
+ */
|
|
|
+ public function currency()
|
|
|
+ {
|
|
|
+ return $this->hasOne(Currency::className(), ['ID' => 'LOCAL_CURRENCY_ID']);
|
|
|
+ }
|
|
|
}
|