public function generateDataSet() { $this->chronometre->debug("------------------------------------------------------------------------------------"); $this->chronometre->debug("----- DEBUT GENERATION DU JEU DE DONNEES"); $this->chronometre->debug("------------------------------------------------------------------------------------"); $timerGlobalStart = microtime(true); /** @var EiDataLineTable $tableJdd */ $tableJdd = Doctrine_Core::getTable("EiDataLine"); /** @var EiTestSetDataSetTable $tableJdtJdd */ $tableJdtJdd = Doctrine_Core::getTable("EiTestSetDataSet"); /** @var EiDataSetStructureTable $tableStrJdd */ $tableStrJdd = Doctrine_Core::getTable("EiDataSetStructure"); $this->chronometre->lancerChrono("Recuperation arbre"); // On récupère l'arbre de la structure du JDD. $structureArbre = $tableStrJdd->getTreeArrayForITree($this->testSet->getEiScenarioId()); // Fin & affichage $this->chronometre->arreterEtAfficherChrono(); $this->chronometre->lancerChrono("IMPORTATION ARBRE"); // On créer le TreeExplorer. $this->tree = new TreeExplorer(); // On importe la structure de l'arbre. $this->tree->import($structureArbre); // Fin & affichage $this->chronometre->arreterEtAfficherChrono(); $chronoGeneration = new Chronometre(); $chronoGeneration->lancerChrono("GENERATION JDD POUR JDT"); // Si un jeu de données existe et que nous sommes à la première génération. if ($this->testSet->getEiDataSetId() != "" && $this->testSet->getEiTestSetDataSet()->count() == 0) { $conn = Doctrine_Manager::connection(); $chronoSub = new Chronometre(); $datas = array(); $nodes = array(); $chronoSub->lancerChrono("PERFORMANCE - COPIE JDD -> JDD FOR JDT"); $tableJdtJdd->copyDataLinesFromDataSet($this->testSet->getId(), $this->testSet->getEiDataSetId(), $conn); $chronoSub->arreterEtAfficherChrono(); $chronoSub->lancerChrono("PERFORMANCE - RECUPERATION ELTS"); $lines = $tableJdtJdd->getLines($this->testSet->getId()); $chronoSub->arreterEtAfficherChrono(); $chronoSub->lancerChrono("PERFORMANCE - TRAITEMENT ELTS"); foreach ($lines as $line) { $data = array("id" => $line["id"], "structure_id" => $line["ei_data_set_structure_id"], "type" => $line["type"], "lft" => $line["lft"], "rgt" => $line["rgt"], "level" => $line["level"]); $data = array_merge($data, $this->evaluateIndexes($nodes, $data["structure_id"], $data["lft"], $data["rgt"])); if ($data["type"] == EiDataSetStructure::$TYPE_NODE) { array_unshift($nodes, $data); } $datas[] = $data; } $chronoSub->arreterEtAfficherChrono(); try { // Début chrono. $chronoSub->lancerChrono("PERFORMANCE - SAUVEGARDE ELTS"); // Début transaction $conn->beginTransaction(); // Insertion des lignes. $tableJdtJdd->updateLinesIndexesFromTab($datas, $this->testSet->getId(), $conn); // COMMIT. $conn->commit(); // Fin chrono. $chronoSub->arreterEtAfficherChrono(); } catch (Exception $exc) { $conn->rollback(); } } else { $this->lignes = $tableStrJdd->createQuery("q")->from("EiDataSetStructure dss")->where("dss.ei_scenario_id = ?", $this->testSet->getEiScenarioId())->andWhere("dss.type = ?", EiDataSetStructure::$TYPE_LEAF)->andWhere("dss.level = 1")->orderBy("dss.lft")->execute(); $this->treatEmpty($this->tree->getRoot()); $this->generate($this->tree->getRoot()); if ($this->maxRight > 2) { // Mise à jour du root_id pour les éléments. $this->root->setRgt($this->maxRight + 1); $this->root->save(); } } // Fin & affichage $chronoGeneration->arreterEtAfficherChrono(); // Arrêt du timer global. $timerGlobalEnd = microtime(true); // Affichage du chrono. $this->chronometre->afficherChrono("GENERATION DU JEU DE DONNEES", $timerGlobalStart, $timerGlobalEnd); }