public function __construct($class = null, $structure = null)
 {
     // Need to secure
     $this->class = $class;
     $this->structure = $structure;
     $this->db = OrmConfig::getConnexion();
 }
示例#2
0
 private function getTables()
 {
     $db = OrmConfig::getConnexion();
     $query = $db->query('SHOW TABLES FROM orm_test');
     if ($query) {
         return $query->fetchAll(\PDO::FETCH_COLUMN);
     } else {
         exit("Table '" . $this->table . "' doesn't exists\n");
     }
 }
示例#3
0
 private function getStructure()
 {
     $db = OrmConfig::getConnexion();
     $query = $db->query('SHOW COLUMNS FROM ' . $this->table);
     if ($query) {
         return $query->fetchAll(\PDO::FETCH_COLUMN);
     } else {
         exit("Table '" . $this->table . "' doesn't exists\n");
     }
 }
示例#4
0
 public function __construct($args, $db_infos)
 {
     OrmConfig::init($db_infos);
     $this->arguments = $args;
     $this->config();
 }
示例#5
0
<pre>
<?php 
require_once '../components/autoload/autoload.php';
use components\ORM\OrmConfig;
use src\Controller\DefaultController;
use components\tools\Yaml\Yaml;
if (!file_exists('../config/config.yml')) {
    echo "Please config database, execute commands: 'php lighten project:init'";
    exit;
}
$config = Yaml::parse(file_get_contents('../config/config.yml'));
$database = $config['database'];
OrmConfig::init($database);
$home = new DefaultController();