diff options
author | Silvio <silvio@devlet.com.br> | 2010-03-31 12:24:53 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-03-31 12:24:53 -0300 |
commit | 5eeabb67d7fa82ac230bb1a323ca3204d59b9915 (patch) | |
tree | a4294640a79931744d8e60e9f20716e943b05d90 /classes/CinIsis.php | |
parent | a39fb6bd4670137a4d682403bf80dd5d1b50ada2 (diff) | |
download | cinisis-5eeabb67d7fa82ac230bb1a323ca3204d59b9915.tar.gz cinisis-5eeabb67d7fa82ac230bb1a323ca3204d59b9915.tar.bz2 |
Adding classe CinIsis
Diffstat (limited to 'classes/CinIsis.php')
-rw-r--r-- | classes/CinIsis.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/classes/CinIsis.php b/classes/CinIsis.php new file mode 100644 index 0000000..300bd61 --- /dev/null +++ b/classes/CinIsis.php @@ -0,0 +1,40 @@ +<?php + +/** + * CinIsis main class. + */ +class CinIsis { + /** + * @var $db + * Database resource. + */ + var $db; + + /** + * @var $implementation + * Database implementation. + */ + var $implementation; + + /** + * Constructor. + * + * @param $config + * Alternative config file (defaults to 'config/config.yaml'). + */ + function __construct($config = NULL) { + if ($config == NULL) { + $config = 'config/config.yaml'; + } + + // Load configuration. + $config = Spyc::YAMLLoad($config); + + // Load database schema. + $schema = Spyc::YAMLLoad('schemas/'. $config['database'] .'.yaml'); + + // Setup database connection. + $this->implementation = $config['implementation'] .'Db'; + $this->db = new $this->implementation($schema); + } +} |