コード例 #1
0
 public function createCity($name, $attr = [])
 {
     if (!($model = $this->findCity($name))) {
         $model = new City();
         $model->name = $name;
         $model->setAttributes($attr);
         $model->save(false);
     }
     return $model;
 }