Пример #1
0
 /**
  * Creates a new Persona model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Persona();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 public function generarInsercionesDinamicas($cantidad)
 {
     $tiempo_inicio = microtime(true);
     if ($cantidad > 0) {
         for ($i = 0; $i < $cantidad; $i++) {
             $persona = new Persona();
             $persona->nombre_completo = "nombre " . $i;
             $persona->pais = "pais " . $i;
             $persona->email = "email " . $i;
             $persona->save();
         }
     }
     $tiempo_fin = microtime(true);
     return "Tiempo empleado: " . ($tiempo_fin - $tiempo_inicio);
 }