示例#1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function createRegionAndCityAndAddress($modelPlaceCountry, $regionPlaceId, $cityPlaceId, $addressPlaceId)
 {
     $modelPlaceRegion = new PlaceRegion();
     $modelPlaceRegion->place_id = $regionPlaceId;
     $modelPlaceRegion->link('country', $modelPlaceCountry);
     $modelPlaceCity = new PlaceCity();
     $modelPlaceCity->place_id = $cityPlaceId;
     $modelPlaceCity->link('region', $modelPlaceRegion);
     $modelPlaceAddress = new PlaceAddress();
     $modelPlaceAddress->place_id = $addressPlaceId;
     $modelPlaceAddress->city_id = $modelPlaceCity->id;
     return $modelPlaceAddress->save() ? $modelPlaceAddress : false;
 }