Пример #1
0
 public function getAdapter()
 {
     if (isset($this->model)) {
         /** @var Model $class */
         $class = $this->model;
         $class::getDbAdapter();
     }
     return Db::getAdapter($this->source);
 }
Пример #2
0
 protected function onPrepare($argv = null)
 {
     $this->adapter = Db::getAdapter($this->source);
     $this->prefix = trim($this->adapter->getConfiguration()['prefix'], ' -_.');
     $this->tables = $this->adapter->getForge()->getDbTables();
     if (!empty($this->namespace)) {
         $this->namespace = str_replace('/', '\\', trim($this->namespace, KE_PATH_NOISE));
     }
 }
Пример #3
0
 protected function onConstruct($argv = null)
 {
     $this->src = App::getApp()->src();
     $this->adapter = Db::getAdapter($this->source);
     $this->className = str_replace('/', '\\', $this->className);
     list($this->namespace, $this->className) = parse_class($this->className);
     if (empty($this->tableName)) {
         $this->tableName = strtolower($this->className);
     }
     $this->tableName = Db::mkTableName($this->source, $this->className, $this->tableName);
 }
Пример #4
0
<?php

/**
 * kephp development env config file.
 */
use Ke\Adm;
use Ke\Utils\DocMen\DocMen;
//DocMen::getInstance('doc')->setShowFile(true)->setGenerable(true)->setWithWiki(true);
// Database config
Adm\Db::define(['default' => ['adapter' => 'mysql', 'db' => '', 'user' => '', 'prefix' => '']]);
// Cache config
Adm\Cache::define(['default' => ['adapter' => 'redis']]);
Пример #5
0
 /**
  * @return Adapter\Db\PdoMySQL|Adapter\DbAdapter
  * @throws \Exception
  */
 public static function getDbAdapter()
 {
     return Db::getAdapter(static::$dbSource);
 }