<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Util
 *
 * @author lavila
 */
class Util {

    private $total_record_count;
    // Contenedor Instancia de la Clase
    private static $instance;

    // A private constructor; previene creacion de objetos via new
    private function __construct() {
        $logger = sfContext::getInstance()->getLogger();
        $logger->info("entro al constructor");
        $this->total_record_count = 0;
    }

    // EL metodo singleton
    public static function singleton() {
        $logger = sfContext::getInstance()->getLogger();
        if (!isset(self::$instance)) {
            $logger->info("Entro al singleton Util");
            $c = __CLASS__;
            self::$instance = new $c;
        }

        return self::$instance;
    }

//    private function __construct() {
//        $this->logMessage("He creado un " . __CLASS__ . "\n");
////        echo "He creado un " . __CLASS__ . "\n";
//        $this->total_record_count = 0;
//    }
//
//    public static function getInstance() {
//        if (!self::$instancia instanceof self) {
//            self::$instancia = new self;
//        }
//        return self::$instancia;
//    }

    public function setTotal($total_record_count) {
        $logger = sfContext::getInstance()->getLogger();
        $logger->info("entro al set del total");
        $this->total_record_count = $total_record_count;
    }

    public function getTotal() {
        $logger = sfContext::getInstance()->getLogger();
        $logger->info("entro al get del total");
        return $this->total_record_count;
    }

}

?>
