public function __construct($class = null, $structure = null) { // Need to secure $this->class = $class; $this->structure = $structure; $this->db = OrmConfig::getConnexion(); }
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"); } }
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"); } }
public function __construct($args, $db_infos) { OrmConfig::init($db_infos); $this->arguments = $args; $this->config(); }
<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();