コード例 #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
ファイル: ScanTables.php プロジェクト: janpoem/kephp
 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
ファイル: NewModel.php プロジェクト: janpoem/kephp
 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
ファイル: development.php プロジェクト: janpoem/kephp
<?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);
 }