Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
63 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
|
||
namespace suda\application\database; | ||
|
||
|
||
use suda\application\Application; | ||
|
||
class Database | ||
{ | ||
/** | ||
* 应用引用 | ||
* | ||
* @var Application | ||
*/ | ||
protected static $application; | ||
|
||
/** | ||
* 从应用创建表 | ||
* | ||
* @param Application $application | ||
* @return void | ||
*/ | ||
public static function loadApplication(Application $application) | ||
{ | ||
static::$application = $application; | ||
} | ||
|
||
/** | ||
* Get 应用引用 | ||
* | ||
* @return Application | ||
*/ | ||
public static function application() | ||
{ | ||
return static::$application; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
|
||
namespace suda\application\database; | ||
|
||
|
||
use suda\application\Application; | ||
use suda\orm\DataSource; | ||
use suda\orm\middleware\Middleware; | ||
|
||
class QueryAccess extends \suda\orm\statement\QueryAccess | ||
{ | ||
public function __construct(Middleware $middleware = null) | ||
{ | ||
parent::__construct(Database::application()->getDataSource(), $middleware); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters