示例#1
0
 public function getCountry()
 {
     return $this->hasOne(Countries::className(), ['country_id' => 'country_id']);
 }
 public function actionCountries()
 {
     $countries = Countries::find()->all();
     $result = [];
     if ($countries) {
         /** @var Countries $country */
         foreach ($countries as $country) {
             $result[] = ArrayHelper::toArray($country);
         }
     }
     return json_encode($result);
 }