suppression de l'objet db dans l'objet QueryBuilder

This commit is contained in:
Gregory Letellier
2023-11-03 08:59:35 +01:00
parent a6c51f5f17
commit 4d7f0d6d83

View File

@@ -3,8 +3,7 @@
namespace Kletellier\PdoWrapper; namespace Kletellier\PdoWrapper;
class QueryBuilder class QueryBuilder
{ {
protected ?Connection $db;
protected array $columns; protected array $columns;
protected array $wheres; protected array $wheres;
protected array $orders; protected array $orders;
@@ -21,8 +20,7 @@ class QueryBuilder
{ {
$this->table = $table; $this->table = $table;
$this->pk = $pk; $this->pk = $pk;
$this->connection = $connection; $this->connection = $connection;
$this->db = null;
$this->reset(); $this->reset();
} }
@@ -196,9 +194,8 @@ class QueryBuilder
} }
private function getData(): mixed private function getData(): mixed
{ {
$this->db = Connection::getInstance($this->connection); return Connection::getInstance($this->connection)->getSelectQuery($this->getQuery());
return $this->db->getSelectQuery($this->getQuery());
} }
private function getConstructedQuery(): Query private function getConstructedQuery(): Query