From 579f9635c2a6213572e16b7549d0e69787e41a79 Mon Sep 17 00:00:00 2001 From: aB0t Date: Tue, 20 Jun 2023 15:09:48 +0200 Subject: [PATCH] update 2023-06-20 15:09:48 --- src/c03b9c61-17d3-4774-a335-783903719f83/code.php | 14 +++++++------- .../code.power | 14 +++++++------- src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php | 8 ++++---- .../code.power | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/c03b9c61-17d3-4774-a335-783903719f83/code.php b/src/c03b9c61-17d3-4774-a335-783903719f83/code.php index 9f87815..dd0acc0 100644 --- a/src/c03b9c61-17d3-4774-a335-783903719f83/code.php +++ b/src/c03b9c61-17d3-4774-a335-783903719f83/code.php @@ -85,13 +85,13 @@ final class Load public function value(array $keys, string $field, string $table) { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table, $field)) + if ($this->table->exist($table, $field)) { return $this->model->value( $this->load->value( ["a.${field}" => $field], ['a' => $table], - $keys + $this->prefix($keys) ), $field, $table @@ -121,13 +121,13 @@ final class Load public function item(array $keys, string $table): ?object { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table)) + if ($this->table->exist($table)) { return $this->model->item( $this->load->item( ['all' => 'a.*'], ['a' => $table], - $keys + $this->prefix($keys) ), $table ); @@ -163,11 +163,11 @@ final class Load public function items(array $keys, string $table): ?array { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table)) + if ($this->table->exist($table)) { return $this->model->items( $this->load->items( - ['all' => 'a.*'], ['a' => $table], $keys + ['all' => 'a.*'], ['a' => $table], $this->prefix($keys) ), $table ); @@ -184,7 +184,7 @@ final class Load * @return array * @since 2.0.1 */ - private function prefix(array $keys): array + private function prefix(array &$keys): array { // update the key values $bucket = []; diff --git a/src/c03b9c61-17d3-4774-a335-783903719f83/code.power b/src/c03b9c61-17d3-4774-a335-783903719f83/code.power index c323fda..dfb8cea 100644 --- a/src/c03b9c61-17d3-4774-a335-783903719f83/code.power +++ b/src/c03b9c61-17d3-4774-a335-783903719f83/code.power @@ -59,13 +59,13 @@ public function value(array $keys, string $field, string $table) { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table, $field)) + if ($this->table->exist($table, $field)) { return $this->model->value( $this->load->value( ["a.${field}" => $field], ['a' => $table], - $keys + $this->prefix($keys) ), $field, $table @@ -95,13 +95,13 @@ public function item(array $keys, string $table): ?object { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table)) + if ($this->table->exist($table)) { return $this->model->item( $this->load->item( ['all' => 'a.*'], ['a' => $table], - $keys + $this->prefix($keys) ), $table ); @@ -137,11 +137,11 @@ public function items(array $keys, string $table): ?array { // check if this is a valid table - if ($this->prefix($keys) && $this->table->exist($table)) + if ($this->table->exist($table)) { return $this->model->items( $this->load->items( - ['all' => 'a.*'], ['a' => $table], $keys + ['all' => 'a.*'], ['a' => $table], $this->prefix($keys) ), $table ); @@ -158,7 +158,7 @@ * @return array * @since 2.0.1 */ - private function prefix(array $keys): array + private function prefix(array &$keys): array { // update the key values $bucket = []; diff --git a/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php b/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php index 658f042..216f325 100644 --- a/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php +++ b/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php @@ -257,7 +257,7 @@ final class Watcher { // check local value if (($chapter_sha = $this->load->value( - ['abbreviation' => $translation, 'nr' => $book, 'chapter' => $chapter], + ['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter], 'sha', 'chapter' )) !== null) { @@ -401,13 +401,13 @@ final class Watcher private function updateHash(string $translation, int $book, int $chapter, string $hash): bool { // load the chapter - if (($chapter = $this->load->value( + if (($item = $this->load->item( ['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter], - 'id', 'chapter' + 'chapter' )) !== null) { $update = []; - $update['id'] = $chapter; + $update['id'] = $item->id; $update['sha'] = $hash; // update the local verses diff --git a/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.power b/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.power index a26cea4..998f996 100644 --- a/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.power +++ b/src/f815fb33-f721-48a5-a84e-53f1986e8881/code.power @@ -227,7 +227,7 @@ { // check local value if (($chapter_sha = $this->load->value( - ['abbreviation' => $translation, 'nr' => $book, 'chapter' => $chapter], + ['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter], 'sha', 'chapter' )) !== null) { @@ -371,13 +371,13 @@ private function updateHash(string $translation, int $book, int $chapter, string $hash): bool { // load the chapter - if (($chapter = $this->load->value( + if (($item = $this->load->item( ['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter], - 'id', 'chapter' + 'chapter' )) !== null) { $update = []; - $update['id'] = $chapter; + $update['id'] = $item->id; $update['sha'] = $hash; // update the local verses