Skip to content

Commit

Permalink
改用OOP的NotORM,优化性能
Browse files Browse the repository at this point in the history
  • Loading branch information
dogstarTest committed Aug 5, 2017
1 parent 72a80d1 commit fe94416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"require": {
"php": ">=5.3.3",
"phalapi/notorm": "2.0.*"
"phalapi/notorm": "2.0.1"
},
"autoload": {
"files": [
Expand Down
4 changes: 3 additions & 1 deletion src/Database/NotORMDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PDOException;
use PhalApi\Database;
use PhalApi\Exception\InternalServerErrorException;
use PhalApi\NotORM\Lite as NotORMLite;

/**
* PhalApi\Database\NotORM 分布式的DB存储
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fe94416

Please sign in to comment.