示例#1
0
文件: Query.php 项目: janpoem/kephp
 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
文件: Model.php 项目: janpoem/kephp
 /**
  * @return Adapter\Db\PdoMySQL|Adapter\DbAdapter
  * @throws \Exception
  */
 public static function getDbAdapter()
 {
     return Db::getAdapter(static::$dbSource);
 }