Example #1
0
    $filter->init();
    $compiler->setOptions(array("compiledPath" => "./view/compiled-files/", "compiledExtension" => ".php", "compileAlways" => true));
    return $volt;
});
// Registering the view component
$di->set('view', function () {
    $view = new View();
    $view->setViewsDir(__DIR__ . '/view');
    $view->registerEngines(array(".phtml" => 'voltService'));
    return $view;
});
$di['tag'] = function () {
    return new AbTag();
};
$di->set('db', function () {
    $config = ApplicationConfig::getMySQLConnection();
    $config['options'] = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
    return new Phalcon\Db\Adapter\Pdo\Mysql($config);
});
$di->set('redis', function () {
    require_once "redisproxy.php";
    $redis = new RedisProxy();
    return $redis;
});
$di->setShared('session', function () {
    $session = new Session();
    $session->start();
    return $session;
});
$di->set('modelsManager', function () {
    return new Phalcon\Mvc\Model\Manager();
 public function tableNames()
 {
     $a = $this->db->fetchAll("SHOW tables");
     $mysql = ApplicationConfig::getMySQLConnection();
     $dbName = $mysql['dbname'];
     $key = "Tables_in_{$dbName}";
     $tableNames = array();
     foreach ($a as $table) {
         array_push($tableNames, $table[$key]);
     }
     return $tableNames;
 }