public function __construct($table) { $tables = Metadata::getInstance()->get('tables'); if (empty($tables[$table])) { throw new \Yabcms\Exception(sprintf('table "%s" not defined in metadata', $table)); } $this->table = $tables[$table]; $this->pdo = Database::getInstance()->getConnection($this->table['connection']); $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); }
<?php require_once 'bootstrap.php'; $user = new Yabcms\Module\User(); var_dump($user, \Yabcms\Metadata::getInstance()->get('tables'));
<?php set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); require 'vendor/autoload.php'; $config = \Yabcms\Config::getInstance(); $config->setConfig(__DIR__ . DIRECTORY_SEPARATOR . 'config.php'); $metadata = \Yabcms\Metadata::getInstance();
public function __construct() { $this->metadata = \Yabcms\Metadata::getInstance(); }