Пример #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLocalisedIdentification()
 {
     return $this->hasOne(CityTranslation::className(), ['city_id' => 'id'])->onCondition(['`city_translation`.`language_id`' => '`city`.`language_id`']);
 }
Пример #2
0
 private function _dummyLocation($countryId, $name, $postCode)
 {
     //CityTranslation::find()->where(['language_id' => 'EN', 'name' => $name])->queryScalar();
     $dummyCity = new \humanized\location\models\location\City(['language_id' => 'EN']);
     try {
         $dummyCity->save();
         try {
             $dummyCityTranslation = new \humanized\location\models\translation\CityTranslation(['language_id' => 'EN', 'city_id' => $dummyCity->id, 'name' => $name]);
             $dummyCityTranslation->save();
             try {
                 $dummyLocation = new \humanized\location\models\location\Location(['postcode' => $postCode, 'city_id' => $dummyCity->id, 'country_id' => $countryId]);
                 $dummyLocation->save();
             } catch (Exception $ex) {
             }
         } catch (Exception $ex) {
         }
     } catch (\Exception $ex) {
     }
 }