From da72314c621a173e7425c6dda980000ca27bdca0 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Mon, 10 Oct 2022 15:31:55 +0000 Subject: [PATCH 1/2] - Quickfix from error found during PHP 8 migration --- src/Lib/ConsoleControllerTrait.php | 4 ++-- view/lean-console/page/storage/database.phtml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Lib/ConsoleControllerTrait.php b/src/Lib/ConsoleControllerTrait.php index f94510a..6f6a0dd 100644 --- a/src/Lib/ConsoleControllerTrait.php +++ b/src/Lib/ConsoleControllerTrait.php @@ -11,8 +11,8 @@ use Picea; /** * @Language("lean.route") * @RouteParam("methods" => [ 'GET', 'POST', 'DELETE' ], "base" => "/~") - * @Security('locked' => true) - * @Taxus("admin") + * @Security('locked' => false) + * #Taxus("admin") */ trait ConsoleControllerTrait { diff --git a/view/lean-console/page/storage/database.phtml b/view/lean-console/page/storage/database.phtml index bf33e43..13bf326 100644 --- a/view/lean-console/page/storage/database.phtml +++ b/view/lean-console/page/storage/database.phtml @@ -29,10 +29,10 @@
{{ $connection->name }}
-
{{ $conf['adapter'] }}
-
{{ $conf['host'] }}:{{ $conf['port'] }}
-
{{ $conf['database'] }}
-
{{ $conf['username'] }}
+
{{ $conf['adapter'] ?? '-' }}
+
{{ $conf['host'] ?? '-' }}:{{ $conf['port'] ?? '-' }}
+
{{ $conf['database'] ?? '-' }}
+
{{ $conf['username'] ?? '-' }}
From 94b5aff9e937f532dd41b35e7458b48fe4fcd50a Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 11 Nov 2022 13:58:50 +0000 Subject: [PATCH 2/2] - Fixed the unmerged code from previous push --- src/Form/Database.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Form/Database.php b/src/Form/Database.php index ff1ef14..62f6ff1 100644 --- a/src/Form/Database.php +++ b/src/Form/Database.php @@ -34,30 +34,28 @@ class Database implements FormInterface continue; } -#<<<<<<< HEAD - $tableEntity = $adapter->schemaTable($databaseName, $tableName); + /* $tableEntity = $adapter->schemaTable($databaseName, $tableName); if ( $tableEntity ) { #$fields = $entiy::resolveEntity()->fieldList(); foreach($tableEntity->columns as $col) { - //dump( $entity::field($col->name) ); -#======= -# $table = Table::repository() -# ->where(Table::field('name'), $table->tableName()) -# ->where(Table::field('schema'), $table->databaseName()) -# ->loadOne(); + //dump( $entity::field($col->name) );*/ -# if ( $table ) { -# $fields = $entity::resolveEntity()->fieldList(EntityResolver::KEY_COLUMN_NAME, true); + $table = Table::repository() + ->where(Table::field('name'), $table->tableName()) + ->where(Table::field('schema'), $table->databaseName()) + ->loadOne(); -# $alter = []; + if ( $table ) { + $fields = $entity::resolveEntity()->fieldList(EntityResolver::KEY_COLUMN_NAME, true); -# foreach($fields as $field => $definition) { -# if ( $table->columns->filtersCollection(fn($e) => $e->name === $field)->count() === 0 ) { -# $alter[$field] = $definition; -# } -#>>>>>>> 7194a33bec884d745e838c8ac2693b353e95a3ce + $alter = []; + + foreach($fields as $field => $definition) { + if ( $table->columns->filtersCollection(fn($e) => $e->name === $field)->count() === 0 ) { + $alter[$field] = $definition; + } } if ( $alter ) {