public function executeEspejo_reportes($tree_id, $list_data_indicador, $fecha_update)
 {
     // $tree_id = $request->getParameter('idTree');
     // $user = $this->getUser()->getAttribute(sfConfig::get('app_session_current_user'),null);
     if ($tree_id != 0) {
         $tree_espejo = TreeScPeer::retrieveByPK($tree_id);
         if (is_object($tree_espejo)) {
             try {
                 $conn = Propel::getConnection();
                 $conn->beginTransaction();
                 $tree_bean = new TmpTreeSc();
                 $tree_bean->setConfigureFlag($tree_espejo->getConfigureFlag());
                 $tree_bean->setFlag("ok");
                 $tree_bean->save();
                 $criterio = new Criteria();
                 $criterio->add(IndicatorsScPeer::TREE_ID, $tree_espejo->getId());
                 $criterio->add(IndicatorsScPeer::FLAG, '%habilitado%', Criteria::LIKE);
                 $criterio->addAscendingOrderByColumn(IndicatorsScPeer::ID);
                 $list_indicadores = IndicatorsScPeer::doSelect($criterio);
                 $list_relation = null;
                 foreach ($list_indicadores as $row) {
                     $indicator_bean = new TmpDataReports();
                     $indicator_bean->setIndicadorId($row->getId());
                     $indicator_bean->setValorMinimo($row->getValorMinimo());
                     $indicator_bean->setValorDeseado($row->getValorDeseado());
                     $indicator_bean->setValorOptimo($row->getValorOptimo());
                     $indicator_bean->setTreeId($tree_bean->getId());
                     $indicator_bean->setUltimoNodo($row->getUltimoNodo());
                     $indicator_bean->setUpdateAt($fecha_update);
                     $indicator_bean->setFlag("ok");
                     if ($row->getPreviousId() == 0) {
                         $indicator_bean->setPreviousId(0);
                     } else {
                         $id_relation = $this->return_relation_id($list_relation, $row->getPreviousId());
                         $indicator_bean->setPreviousId($id_relation);
                     }
                     if ($row->getParents() != "") {
                         $parents = $this->return_parent_relation($list_relation, $row->getParents());
                         $indicator_bean->setParents($parents);
                     }
                     //preguntar si es ultmo idicador
                     //->getUltimoNodo()
                     //si es ultimo nodo tengo que pasar la data actual
                     //a  data que se esta creando ->
                     $indicator_bean->setConectoresConfigure($row->getConectoresConfigure());
                     $indicator_bean->save();
                     //actualizo el valor actual entregado
                     $relation = array('array' => '' . $row->getId() . '-' . $indicator_bean->getId() . '');
                     $list_relation[] = $relation;
                 }
                 foreach ($list_data_indicador as $obj_data) {
                     $criteria = new Criteria();
                     $id = $this->return_relation_id($list_relation, $obj_data->getIndicadorId());
                     $criteria->add(TmpDataReportsPeer::ID, $id);
                     $obj_update_tmp = TmpDataReportsPeer::doSelectOne($criteria);
                     $obj_update_tmp->setData($obj_data->getData());
                     $obj_update_tmp->save();
                 }
                 $conn->commit();
                 $conn = Propel::close();
                 // VOY A DEVOLVER UN ARREGLO CON DOS VALORES 1) ID DEL TREE TEMPORAL, 2) LA LISTA DE LA RELACION
                 $result = array('array' => $tree_bean->getId(), "lista" => $list_relation);
                 return $result;
                 //$this->list_relation = $list_relation;
                 //$this->redirect('@edit_strategy?id_tree='.$tree_bean->getId());
             } catch (Exception $e) {
                 $conn->rollBack();
                 // $this->message = $e->getMessage();
                 $conn = Propel::close();
                 return sfView::ERROR;
             }
         } else {
             // $this->message = 'tree not definitive';
             $conn = Propel::close();
             return sfView::ERROR;
         }
     } else {
         //   $this->message = 'session expired';
         $conn = Propel::close();
         return sfView::ERROR;
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      TmpDataReports $value A TmpDataReports object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(TmpDataReports $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }