From fe94416cddf1a30f8e2ef50b6630acab42d6dcfa Mon Sep 17 00:00:00 2001 From: dogstar Date: Sat, 5 Aug 2017 02:33:06 -0700 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8OOP=E7=9A=84NotORM=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- src/Database/NotORMDatabase.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 06148b0..29d4a1a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ ], "require": { "php": ">=5.3.3", - "phalapi/notorm": "2.0.*" + "phalapi/notorm": "2.0.1" }, "autoload": { "files": [ diff --git a/src/Database/NotORMDatabase.php b/src/Database/NotORMDatabase.php index 204d4f5..bae6467 100644 --- a/src/Database/NotORMDatabase.php +++ b/src/Database/NotORMDatabase.php @@ -5,6 +5,7 @@ use PDOException; use PhalApi\Database; use PhalApi\Exception\InternalServerErrorException; +use PhalApi\NotORM\Lite as NotORMLite; /** * PhalApi\Database\NotORM 分布式的DB存储 @@ -112,9 +113,10 @@ public function __get($name) { list($tableName, $suffix) = $this->parseName($name); $router = $this->getDBRouter($tableName, $suffix); + $this->_notorms[$notormKey] = new NotORMLite($router['pdo']); $structure = new \NotORM_Structure_Convention( $router['key'], '%s_id', '%s', $router['prefix']); - $this->_notorms[$notormKey] = new \NotORM($router['pdo'], $structure); + $this->_notorms[$notormKey]->setStructure($structure); // 调试模式与回调函数 $this->_notorms[$notormKey]->debug = $this->debug;