public function actionSaveWPQuest($id) { $run = Runs::model()->findByPk($id); $plataforma = Platforms::model()->findByPk($run['id_platform']); // array com os testes default $defaultTestsKeys = array(1.1, 1.2, 1.3, 2.1, 2.2, 2.3, 2.4, 5.1, 5.2, 5.3, 5.4, 7.3, 7.4, 7.5, 7.6, 7.7, 8.1, 8.199999999999999, 8.300000000000001, 8.4, 8.5); // pegar os ID,s selecionados // verificar inde tem virgula // montar uma lista com todos os compostos // replicar esse codigo abaixo // consertar essa gambiarra URGENTE foreach ($defaultTestsKeys as $key) { $testRuns = TestCase::model()->findBySql('SELECT * FROM `test_case` where num = ' . $key); if ($testRuns["id"] != "") { $id_testcase = $testRuns["id"]; // echo $testRuns["id"]."<br/>"; $id_runs = $id; $connection = Yii::app()->db; $command = $connection->createCommand("INSERT INTO `test_run`(`id_runs`, `id_test_case`, `status`) VALUES (" . $id_runs . "," . $testRuns["id"] . ",0)"); $rowCount = $command->execute(); } } $this->redirect(array('view', 'id' => $id)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return TestCase the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TestCase::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }