From b0ae800ab8f99c5a1bf6247419df52fdf3cab226 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Sun, 10 Mar 2024 21:12:42 -0300 Subject: [PATCH] Fix deprecated creation of dynamic property Also fix SQLite Driver results and writeable column name --- .../Builder/Syntax/Adapt/SQLite3/InsertWriter.php | 6 +++--- system/database/Databases/Driver/SQLite3.php | 2 +- system/system.php | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/system/MagiQL/Builder/Syntax/Adapt/SQLite3/InsertWriter.php b/system/MagiQL/Builder/Syntax/Adapt/SQLite3/InsertWriter.php index 43c918f..421f9c8 100644 --- a/system/MagiQL/Builder/Syntax/Adapt/SQLite3/InsertWriter.php +++ b/system/MagiQL/Builder/Syntax/Adapt/SQLite3/InsertWriter.php @@ -11,7 +11,7 @@ namespace Phacil\Framework\MagiQL\Builder\Syntax\Adapt\SQLite3; use Phacil\Framework\MagiQL\Builder\Syntax\InsertWriter as GenericWriter; use Phacil\Framework\MagiQL\Api\BuilderInterface; use Phacil\Framework\MagiQL\Builder\Syntax\PlaceholderWriter; -use Phacil\Framework\MagiQL\Builder\Syntax\Adapt\SQLite3\ColumnWriter; +//use Phacil\Framework\MagiQL\Builder\Syntax\Adapt\SQLite3\ColumnWriter; class InsertWriter extends GenericWriter { @@ -22,7 +22,7 @@ class InsertWriter extends GenericWriter public function __construct(BuilderInterface $writer, PlaceholderWriter $placeholder) { $this->writer = $writer; - $this->columnWriter = new ColumnWriter($this->writer, $placeholder); + //$this->columnWriter = new ColumnWriter($this->writer, $placeholder); } /** @@ -32,6 +32,6 @@ class InsertWriter extends GenericWriter */ protected function writeQueryColumns($columns) { - return $this->writeCommaSeparatedValues($columns, $this->columnWriter, 'writeColumnWithoutTable'); + return $this->writeCommaSeparatedValues($columns, $this->writer, 'writeColumnName'); } } diff --git a/system/database/Databases/Driver/SQLite3.php b/system/database/Databases/Driver/SQLite3.php index 2e79e61..143bd1d 100644 --- a/system/database/Databases/Driver/SQLite3.php +++ b/system/database/Databases/Driver/SQLite3.php @@ -116,7 +116,7 @@ class SQLite3 implements DriverInterface { } // Processar resultados se for um SELECT - if ($result instanceof \SQLite3Result) { + if ($result instanceof \SQLite3Result && $result->numColumns() > 0) { $data = []; while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $data[] = $row; diff --git a/system/system.php b/system/system.php index 462263b..8425f32 100644 --- a/system/system.php +++ b/system/system.php @@ -357,20 +357,20 @@ final class startEngineExacTI { switch ($key) { case 'mail': /** @var \Phacil\Framework\Mail\Api\MailInterface */ - $this->registry->$key = $this->registry->getInstance(\Phacil\Framework\Mail\Api\MailInterface::class); + $this->registry->set($key, $this->registry->getInstance(\Phacil\Framework\Mail\Api\MailInterface::class)); break; case 'translate': - $this->registry->$key = $this->registry->getInstance(\Phacil\Framework\Translate::class); + $this->registry->set($key, $this->registry->getInstance(\Phacil\Framework\Translate::class)); break; case 'session': - $this->registry->$key = $this->registry->getInstance(\Phacil\Framework\Session::class); + $this->registry->set($key, $this->registry->getInstance(\Phacil\Framework\Session::class)); break; case 'document': /** @var \Phacil\Framework\Api\Document */ - $this->registry->$key = $this->registry->getInstance(\Phacil\Framework\Api\Document::class); + $this->registry->set($key, $this->registry->getInstance(\Phacil\Framework\Api\Document::class)); break; default: @@ -378,7 +378,7 @@ final class startEngineExacTI { break; } - return isset($this->registry->$key) ? $this->registry->$key : null; + return ($this->registry->has($key)) ? $this->registry->get($key) : null; } /** @return \Phacil\Framework\Registry */