ajout des transactions
This commit is contained in:
@@ -160,6 +160,30 @@ class Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function beginTransaction(): bool
|
||||||
|
{
|
||||||
|
if ($this->pdo) {
|
||||||
|
return $this->pdo->beginTransaction();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function commit(): bool
|
||||||
|
{
|
||||||
|
if ($this->pdo) {
|
||||||
|
return $this->pdo->commit();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rollback(): bool
|
||||||
|
{
|
||||||
|
if ($this->pdo) {
|
||||||
|
return $this->pdo->rollBack();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function init($config, array $connections = ["default"])
|
public static function init($config, array $connections = ["default"])
|
||||||
{
|
{
|
||||||
self::fillInstances($config, $connections);
|
self::fillInstances($config, $connections);
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ class Model
|
|||||||
$res = false;
|
$res = false;
|
||||||
$qb = $this->newQueryBuilder();
|
$qb = $this->newQueryBuilder();
|
||||||
$find = $qb->find($key);
|
$find = $qb->find($key);
|
||||||
if($find!==null)
|
if ($find !== null) {
|
||||||
{
|
|
||||||
$this->fillData($find->getValues());
|
$this->fillData($find->getValues());
|
||||||
$res = true;
|
$res = true;
|
||||||
}
|
}
|
||||||
@@ -139,6 +138,5 @@ class Model
|
|||||||
$table = strtolower($classNameWithoutNamespace);
|
$table = strtolower($classNameWithoutNamespace);
|
||||||
|
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user