コード例 #1
0
ファイル: Util.php プロジェクト: rrmoura1/Abstergo
 /**
  * Importa classes
  *
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br/
  * @return void
  */
 public static function import()
 {
     $list = func_get_args();
     foreach ($list as $item) {
         $parts = explode(".", $item);
         $class = array_pop($parts);
         $cm = Lumine_ConnectionManager::getInstance();
         $cfg = $cm->getConfiguration(implode('.', $parts));
         if ($cfg != false) {
             $cfg->import($class);
         }
     }
 }
コード例 #2
0
ファイル: Configuration.php プロジェクト: rrmoura1/Abstergo
 /**
  * Construtor da classe
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br/
  * @param array $options lista de opcoes
  * @return Lumine_Configuration
  */
 function __construct(array $options)
 {
     if (empty($options['dialect'])) {
         throw new Lumine_Exception("Dialeto nao definido na configuracao", Lumine_Exception::CONFIG_NO_DIALECT);
         return;
     }
     if (empty($options['database'])) {
         throw new Lumine_Exception("Banco de dados nao definido na configuracao", Lumine_Exception::CONFIG_NO_DIALECT);
         return;
     }
     if (empty($options['user'])) {
         throw new Lumine_Exception("Usuario nao definido na configuracao", Lumine_Exception::CONFIG_NO_DIALECT);
         return;
     }
     if (empty($options['class_path'])) {
         throw new Lumine_Exception("Class-path nao definida na configuracao", Lumine_Exception::CONFIG_NO_DIALECT);
         return;
     }
     if (empty($options['package'])) {
         throw new Lumine_Exception("Pacote nao definido na configuracao", Lumine_Exception::CONFIG_NO_DIALECT);
         return;
     }
     // opcionais, coloca valores padroes se nao informados
     if (!isset($options['password'])) {
         Lumine_Log::debug('Senha nao definida na configuracao');
         $options['password'] = '';
     }
     if (!isset($options['port'])) {
         Lumine_Log::debug('Porta nao definido na configuracao');
         $options['port'] = '';
     }
     if (!isset($options['host'])) {
         Lumine_Log::debug('Host nao definido na configuracao');
         $options['host'] = 'localhost';
     }
     $this->options = $options;
     $cnManager = Lumine_ConnectionManager::getInstance();
     $cnManager->create($this->options['package'], $this);
 }
コード例 #3
0
ファイル: Base.php プロジェクト: bladerangel/aplicacao
 /**
  * Recupera o objeto de configuracao atual
  *
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br/lumine
  * @return Lumine_Configuration Objeto de configuracao atual
  */
 public function _getConfiguration()
 {
     $pkg = $this->metadata()->getPackage();
     if (!empty($pkg)) {
         return Lumine_ConnectionManager::getInstance()->getConfiguration($pkg);
     }
 }
コード例 #4
0
ファイル: Base.php プロジェクト: rrmoura1/Abstergo
 /**
  * Recupera o objeto de configuracao atual
  *
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br/lumine
  * @return Lumine_Configuration Objeto de configuracao atual
  */
 public function _getConfiguration()
 {
     if (!empty($this->_package)) {
         return Lumine_ConnectionManager::getInstance()->getConfiguration($this->_package);
     }
 }
コード例 #5
0
ファイル: Lumine.php プロジェクト: bladerangel/aplicacao
 /**
  * faz a importacao automatica de classes (autoload)
  *
  * @see http://br2.php.net/manual/pt_BR/function.spl-autoload-register.php
  * @param string $clname
  */
 public static function autoload($clname)
 {
     $args = func_get_args();
     $cn = Lumine_ConnectionManager::getInstance();
     $list = $cn->getConfigurationList();
     foreach ($list as $cfg) {
         $sufix = $cfg->getOption('class_sufix');
         $pacote = $cfg->getProperty('package');
         $path = $cfg->getProperty('class_path');
         $ext = (empty($sufix) ? '' : '.' . $sufix) . '.php';
         if (!empty($pacote)) {
             $pacote .= '.';
         }
         $fullpath = str_replace('.', '/', $path . '/' . $pacote . $clname);
         $fullpath .= $ext;
         if (file_exists($fullpath)) {
             Lumine_Util::import($pacote . $clname);
             return;
         }
     }
 }
コード例 #6
0
 /**
  * @see Lumine_EventListener::__destruct()
  */
 function __destruct()
 {
     self::$instance = null;
     $this->connections = array();
     parent::__destruct();
 }