变更
This commit is contained in:
+8
-9
@@ -189,12 +189,12 @@ class Connection extends Component
|
|||||||
public function getPdo(bool $restore = false): Mysql\PDO
|
public function getPdo(bool $restore = false): Mysql\PDO
|
||||||
{
|
{
|
||||||
if ($restore === true) {
|
if ($restore === true) {
|
||||||
return Context::setContext($this->cds, $this->getMasterClient());
|
return Context::set($this->cds, $this->getMasterClient());
|
||||||
}
|
}
|
||||||
if (!Context::hasContext($this->cds)) {
|
if (!Context::exists($this->cds)) {
|
||||||
return Context::setContext($this->cds, $this->getMasterClient());
|
return Context::set($this->cds, $this->getMasterClient());
|
||||||
} else {
|
} else {
|
||||||
return Context::getContext($this->cds);
|
return Context::get($this->cds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,11 +254,10 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function release(Mysql\PDO $PDO)
|
public function release(Mysql\PDO $PDO)
|
||||||
{
|
{
|
||||||
// if ($PDO->inTransaction()) {
|
if ($PDO->inTransaction() === false) {
|
||||||
// return;
|
$this->connection->addItem($this->cds, $PDO);
|
||||||
// }
|
Context::remove($this->cds);
|
||||||
$this->connection->addItem($this->cds, $PDO);
|
}
|
||||||
Context::remove($this->cds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Db implements ISqlBuilder
|
|||||||
*/
|
*/
|
||||||
public static function inTransactionsActive(): bool
|
public static function inTransactionsActive(): bool
|
||||||
{
|
{
|
||||||
return Context::hasContext('transactions::status') && Context::getContext('transactions::status') === true;
|
return Context::exists('transactions::status') && Context::get('transactions::status') === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class Db implements ISqlBuilder
|
|||||||
*/
|
*/
|
||||||
public static function beginTransaction(): void
|
public static function beginTransaction(): void
|
||||||
{
|
{
|
||||||
Context::setContext('transactions::status', true);
|
Context::set('transactions::status', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -55,14 +55,14 @@ class Relation extends Component
|
|||||||
*/
|
*/
|
||||||
public function first(string $_identification): mixed
|
public function first(string $_identification): mixed
|
||||||
{
|
{
|
||||||
if (Context::hasContext($_identification)) {
|
if (Context::exists($_identification)) {
|
||||||
return Context::getContext($_identification);
|
return Context::get($_identification);
|
||||||
}
|
}
|
||||||
$activeModel = $this->_query[$_identification]->first();
|
$activeModel = $this->_query[$_identification]->first();
|
||||||
if (empty($activeModel)) {
|
if (empty($activeModel)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Context::setContext($_identification, $activeModel);
|
return Context::set($_identification, $activeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,14 +72,14 @@ class Relation extends Component
|
|||||||
*/
|
*/
|
||||||
public function count(string $_identification): mixed
|
public function count(string $_identification): mixed
|
||||||
{
|
{
|
||||||
if (Context::hasContext($_identification)) {
|
if (Context::exists($_identification)) {
|
||||||
return Context::getContext($_identification);
|
return Context::get($_identification);
|
||||||
}
|
}
|
||||||
$activeModel = $this->_query[$_identification]->count();
|
$activeModel = $this->_query[$_identification]->count();
|
||||||
if (empty($activeModel)) {
|
if (empty($activeModel)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Context::setContext($_identification, $activeModel);
|
return Context::set($_identification, $activeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,14 +89,14 @@ class Relation extends Component
|
|||||||
*/
|
*/
|
||||||
public function get(string $_identification): mixed
|
public function get(string $_identification): mixed
|
||||||
{
|
{
|
||||||
if (Context::hasContext($_identification)) {
|
if (Context::exists($_identification)) {
|
||||||
return Context::getContext($_identification);
|
return Context::get($_identification);
|
||||||
}
|
}
|
||||||
$activeModel = $this->_query[$_identification]->get();
|
$activeModel = $this->_query[$_identification]->get();
|
||||||
if (empty($activeModel)) {
|
if (empty($activeModel)) {
|
||||||
return $activeModel;
|
return $activeModel;
|
||||||
}
|
}
|
||||||
return Context::setContext($_identification, $activeModel);
|
return Context::set($_identification, $activeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user