diff --git a/src/91b37bd7-b314-48be-91cf-434ec823bd80/README.md b/src/91b37bd7-b314-48be-91cf-434ec823bd80/README.md index b34e308..8eeb77f 100644 --- a/src/91b37bd7-b314-48be-91cf-434ec823bd80/README.md +++ b/src/91b37bd7-b314-48be-91cf-434ec823bd80/README.md @@ -17,6 +17,7 @@ class Upsert << (F,LightGreen) >> #Green { # validateBefore(mixed $value, ?string $field = null, ...) : bool # validateAfter(mixed $value, ?string $field = null, ...) : bool # getTable() : string + + modelDistributionHistory(mixed $value) : mixed } note right of Upsert::__construct @@ -68,6 +69,13 @@ note right of Upsert::getTable since: 2.0.1 return: string end note + +note right of Upsert::modelDistributionHistory + Model Translation History + + since: 2.0.1 + return: mixed +end note @enduml ``` diff --git a/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.php b/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.php index 240eee4..17a65e0 100644 --- a/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.php +++ b/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.php @@ -73,6 +73,12 @@ final class Upsert extends Model implements ModelInterface // check if this is a valid table if (($store = $this->table->get($table, $field, 'store')) !== null) { + // Model Translation History + if ($table === 'translation' && $field === 'distribution_history') + { + $value = $this->modelDistributionHistory($value); + } + // open the value based on the store method switch($store) { @@ -136,6 +142,30 @@ final class Upsert extends Model implements ModelInterface protected function getTable(): string { return $this->config->table_name; + } + + /** + * Model Translation History + * + * @param mixed $value The value to model + * + * @return mixed + * @since 2.0.1 + */ + public function modelDistributionHistory($value) + { + if (ObjectHelper::check($value)) + { + $n = 0; + $bucket = []; + foreach ($value as $version => $description) + { + $bucket["distribution_history$n"] = ['version' => $version, 'description' => $description]; + $n++; + } + return $bucket; + } + return ''; } } diff --git a/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.power b/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.power index 8fbcc07..b945487 100644 --- a/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.power +++ b/src/91b37bd7-b314-48be-91cf-434ec823bd80/code.power @@ -43,6 +43,12 @@ // check if this is a valid table if (($store = $this->table->get($table, $field, 'store')) !== null) { + // Model Translation History + if ($table === 'translation' && $field === 'distribution_history') + { + $value = $this->modelDistributionHistory($value); + } + // open the value based on the store method switch($store) { @@ -106,4 +112,28 @@ protected function getTable(): string { return $this->config->table_name; + } + + /** + * Model Translation History + * + * @param mixed $value The value to model + * + * @return mixed + * @since 2.0.1 + */ + public function modelDistributionHistory($value) + { + if (ObjectHelper::check($value)) + { + $n = 0; + $bucket = []; + foreach ($value as $version => $description) + { + $bucket["distribution_history$n"] = ['version' => $version, 'description' => $description]; + $n++; + } + return $bucket; + } + return ''; } \ No newline at end of file diff --git a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/README.md b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/README.md index 654934b..18db48b 100644 --- a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/README.md +++ b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/README.md @@ -15,10 +15,10 @@ class Insert << (F,LightGreen) >> #Green { # Database $database + __construct(Model $model, Database $database) + value(mixed $value, string $field, ...) : bool - + row(array $item) : bool - + rows(?array $items) : bool - + item(object $item) : bool - + items(?array $items) : bool + + row(array $item, string $table) : bool + + rows(?array $items, string $table) : bool + + item(object $item, string $table) : bool + + items(?array $items, string $table) : bool } note right of Insert::__construct @@ -29,7 +29,7 @@ end note note right of Insert::value Insert a value to a given table -Example: $this->value(Value, 'value_key', 'GUID'); +Example: $this->value(Value, 'value_key', 'table_name'); since: 2.0.1 return: bool @@ -37,13 +37,12 @@ Example: $this->value(Value, 'value_key', 'GUID'); arguments: mixed $value string $field - string $keyValue - string $key = 'guid' + string $table end note note right of Insert::row Insert single row with multiple values to a given table -Example: $this->item(Array); +Example: $this->item(Array, 'table_name'); since: 2.0.1 return: bool @@ -51,7 +50,7 @@ end note note right of Insert::rows Insert multiple rows to a given table -Example: $this->items(Array); +Example: $this->items(Array, 'table_name'); since: 2.0.1 return: bool @@ -59,7 +58,7 @@ end note note right of Insert::item Insert single item with multiple values to a given table -Example: $this->item(Object); +Example: $this->item(Object, 'table_name'); since: 2.0.1 return: bool @@ -67,7 +66,7 @@ end note note right of Insert::items Insert multiple items to a given table -Example: $this->items(Array); +Example: $this->items(Array, 'table_name'); since: 2.0.1 return: bool diff --git a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.php b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.php index 4ed87f5..c6e9c69 100644 --- a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.php +++ b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.php @@ -55,103 +55,105 @@ final class Insert /** * Insert a value to a given table - * Example: $this->value(Value, 'value_key', 'GUID'); + * Example: $this->value(Value, 'value_key', 'table_name'); * - * @param mixed $value The field value - * @param string $field The field key - * @param string $keyValue The key value - * @param string $key The key name + * @param mixed $value The field value + * @param string $field The field key + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function value($value, string $field, string $keyValue, string $key = 'guid'): bool + public function value($value, string $field, string $table): bool { // build the array $item = []; - $item[$key] = $keyValue; $item[$field] = $value; // Insert the column of this table - return $this->row($item); + return $this->row($item, $table); } /** * Insert single row with multiple values to a given table - * Example: $this->item(Array); + * Example: $this->item(Array, 'table_name'); * * @param array $item The item to save + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function row(array $item): bool + public function row(array $item, string $table): bool { // check if object could be modelled - if (($item = $this->model->row($item, 'power')) !== null) + if (($item = $this->model->row($item, $table)) !== null) { // Insert the column of this table - return $this->database->row($item, 'power'); + return $this->database->row($item, $table); } return false; } /** * Insert multiple rows to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'table_name'); * * @param array|null $items The items updated in database (array of arrays) + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function rows(?array $items): bool + public function rows(?array $items, string $table): bool { // check if object could be modelled - if (($items = $this->model->rows($items, 'power')) !== null) + if (($items = $this->model->rows($items, $table)) !== null) { // Insert the column of this table - return $this->database->rows($items, 'power'); + return $this->database->rows($items, $table); } return false; } /** * Insert single item with multiple values to a given table - * Example: $this->item(Object); + * Example: $this->item(Object, 'table_name'); * * @param object $item The item to save + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function item(object $item): bool + public function item(object $item, string $table): bool { // check if object could be modelled - if (($item = $this->model->item($item, 'power')) !== null) + if (($item = $this->model->item($item, $table)) !== null) { - // Insert the column of this table - return $this->database->item($item, 'power'); + // Insert the column of this table. + return $this->database->item($item, $table); } return false; } /** * Insert multiple items to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'table_name'); * * @param array|null $items The items updated in database (array of objects) + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function items(?array $items): bool + public function items(?array $items, string $table): bool { // check if object could be modelled - if (($items = $this->model->items($items, 'power')) !== null) + if (($items = $this->model->items($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->items($items, 'power'); + // Insert the column of this table. + return $this->database->items($items, $table); } return false; } diff --git a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.power b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.power index e1fe369..02e543e 100644 --- a/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.power +++ b/src/a07d90f6-6ff2-40a1-99c1-0f2cf33c9adf/code.power @@ -30,103 +30,105 @@ /** * Insert a value to a given table - * Example: $this->value(Value, 'value_key', 'GUID'); + * Example: $this->value(Value, 'value_key', 'table_name'); * - * @param mixed $value The field value - * @param string $field The field key - * @param string $keyValue The key value - * @param string $key The key name + * @param mixed $value The field value + * @param string $field The field key + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function value($value, string $field, string $keyValue, string $key = 'guid'): bool + public function value($value, string $field, string $table): bool { // build the array $item = []; - $item[$key] = $keyValue; $item[$field] = $value; // Insert the column of this table - return $this->row($item); + return $this->row($item, $table); } /** * Insert single row with multiple values to a given table - * Example: $this->item(Array); + * Example: $this->item(Array, 'table_name'); * * @param array $item The item to save + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function row(array $item): bool + public function row(array $item, string $table): bool { // check if object could be modelled - if (($item = $this->model->row($item, 'power')) !== null) + if (($item = $this->model->row($item, $table)) !== null) { // Insert the column of this table - return $this->database->row($item, 'power'); + return $this->database->row($item, $table); } return false; } /** * Insert multiple rows to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'table_name'); * * @param array|null $items The items updated in database (array of arrays) + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function rows(?array $items): bool + public function rows(?array $items, string $table): bool { // check if object could be modelled - if (($items = $this->model->rows($items, 'power')) !== null) + if (($items = $this->model->rows($items, $table)) !== null) { // Insert the column of this table - return $this->database->rows($items, 'power'); + return $this->database->rows($items, $table); } return false; } /** * Insert single item with multiple values to a given table - * Example: $this->item(Object); + * Example: $this->item(Object, 'table_name'); * * @param object $item The item to save + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function item(object $item): bool + public function item(object $item, string $table): bool { // check if object could be modelled - if (($item = $this->model->item($item, 'power')) !== null) + if (($item = $this->model->item($item, $table)) !== null) { - // Insert the column of this table - return $this->database->item($item, 'power'); + // Insert the column of this table. + return $this->database->item($item, $table); } return false; } /** * Insert multiple items to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'table_name'); * * @param array|null $items The items updated in database (array of objects) + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function items(?array $items): bool + public function items(?array $items, string $table): bool { // check if object could be modelled - if (($items = $this->model->items($items, 'power')) !== null) + if (($items = $this->model->items($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->items($items, 'power'); + // Insert the column of this table. + return $this->database->items($items, $table); } return false; } \ No newline at end of file diff --git a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/README.md b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/README.md index 5d200d3..b3ec9aa 100644 --- a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/README.md +++ b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/README.md @@ -17,6 +17,7 @@ class Load << (F,LightGreen) >> #Green { # validateBefore(mixed $value, ?string $field = null, ...) : bool # validateAfter(mixed $value, ?string $field = null, ...) : bool # getTable() : string + + modelDistributionHistory(mixed $value) : mixed } note right of Load::__construct @@ -68,6 +69,13 @@ note right of Load::getTable since: 2.0.1 return: string end note + +note right of Load::modelDistributionHistory + Model Distribution History + + since: 2.0.1 + return: mixed +end note @enduml ``` diff --git a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.php b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.php index da64002..a4c4c6f 100644 --- a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.php +++ b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.php @@ -80,6 +80,12 @@ final class Load extends Model implements ModelInterface $value = json_decode($value); break; } + + // Model Distribution History + if ($table === 'translation' && $field === 'distribution_history') + { + $value = $this->modelDistributionHistory($value); + } } return $value; @@ -136,6 +142,19 @@ final class Load extends Model implements ModelInterface protected function getTable(): string { return $this->config->table_name; + } + + /** + * Model Distribution History + * + * @param mixed $value The value to model + * + * @return mixed + * @since 2.0.1 + */ + public function modelDistributionHistory($value) + { + return $value; } } diff --git a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.power b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.power index a338265..1fb298c 100644 --- a/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.power +++ b/src/b1bd2b4f-dede-44ad-86e9-2a595a0a9ca0/code.power @@ -50,6 +50,12 @@ $value = json_decode($value); break; } + + // Model Distribution History + if ($table === 'translation' && $field === 'distribution_history') + { + $value = $this->modelDistributionHistory($value); + } } return $value; @@ -106,4 +112,17 @@ protected function getTable(): string { return $this->config->table_name; + } + + /** + * Model Distribution History + * + * @param mixed $value The value to model + * + * @return mixed + * @since 2.0.1 + */ + public function modelDistributionHistory($value) + { + return $value; } \ No newline at end of file diff --git a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/README.md b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/README.md index 1627ff4..6c5493a 100644 --- a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/README.md +++ b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/README.md @@ -15,10 +15,10 @@ class Update << (F,LightGreen) >> #Green { # Database $database + __construct(Model $model, Database $database) + value(mixed $value, string $field, ...) : bool - + row(array $item) : bool - + rows(?array $items) : bool - + item(object $item) : bool - + items(?array $items) : bool + + row(array $item, string $key, ...) : bool + + rows(?array $items, string $key, ...) : bool + + item(object $item, string $key, ...) : bool + + items(?array $items, string $key, ...) : bool } note right of Update::__construct @@ -29,7 +29,7 @@ end note note right of Update::value Update a value to a given table -Example: $this->value(Value, 'value_key', 'GUID'); +Example: $this->value(Value, 'value_key', 'id', 'table_name'); since: 2.0.1 return: bool @@ -38,39 +38,60 @@ Example: $this->value(Value, 'value_key', 'GUID'); mixed $value string $field string $keyValue - string $key = 'guid' + string $key + string $table end note note right of Update::row Update single row with multiple values to a given table -Example: $this->item(Array); +Example: $this->item(Array, 'id', 'table_name'); since: 2.0.1 return: bool + + arguments: + array $item + string $key + string $table end note note right of Update::rows Update multiple rows to a given table -Example: $this->items(Array); +Example: $this->items(Array, 'id', 'table_name'); since: 2.0.1 return: bool + + arguments: + ?array $items + string $key + string $table end note note right of Update::item Update single item with multiple values to a given table -Example: $this->item(Object); +Example: $this->item(Object, 'id', 'table_name'); since: 2.0.1 return: bool + + arguments: + object $item + string $key + string $table end note note right of Update::items Update multiple items to a given table -Example: $this->items(Array); +Example: $this->items(Array, 'id', 'table_name'); since: 2.0.1 return: bool + + arguments: + ?array $items + string $key + string $table end note @enduml diff --git a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.php b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.php index 1fe49da..dfa4101 100644 --- a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.php +++ b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.php @@ -55,17 +55,18 @@ final class Update /** * Update a value to a given table - * Example: $this->value(Value, 'value_key', 'GUID'); + * Example: $this->value(Value, 'value_key', 'id', 'table_name'); * * @param mixed $value The field value * @param string $field The field key * @param string $keyValue The key value * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function value($value, string $field, string $keyValue, string $key = 'guid'): bool + public function value($value, string $field, string $keyValue, string $key, string $table): bool { // build the array $item = []; @@ -73,85 +74,93 @@ final class Update $item[$field] = $value; // Update the column of this table using guid as the primary key. - return $this->row($item); + return $this->row($item, $key, $table); } /** * Update single row with multiple values to a given table - * Example: $this->item(Array); + * Example: $this->item(Array, 'id', 'table_name'); * - * @param array $item The item to save + * @param array $item The item to save + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function row(array $item): bool + public function row(array $item, string $key, string $table): bool { // check if object could be modelled - if (($item = $this->model->row($item, 'power')) !== null) + if (($item = $this->model->row($item, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->row($item, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->row($item, $key, $table); } return false; } /** * Update multiple rows to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'id', 'table_name'); * - * @param array|null $items The items updated in database (array of arrays) + * @param array|null $items The items updated in database (array of arrays) + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function rows(?array $items): bool + public function rows(?array $items, string $key, string $table): bool { // check if object could be modelled - if (($items = $this->model->rows($items, 'power')) !== null) + if (($items = $this->model->rows($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->rows($items, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->rows($items, $key, $table); } return false; } /** * Update single item with multiple values to a given table - * Example: $this->item(Object); + * Example: $this->item(Object, 'id', 'table_name'); * * @param object $item The item to save + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function item(object $item): bool + public function item(object $item, string $key, string $table): bool { // check if object could be modelled - if (($item = $this->model->item($item, 'power')) !== null) + if (($item = $this->model->item($item, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->item($item, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->item($item, $key, $table); } return false; } /** * Update multiple items to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'id', 'table_name'); * - * @param array|null $items The items updated in database (array of objects) + * @param array|null $items The items updated in database (array of objects) + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function items(?array $items): bool + public function items(?array $items, string $key, string $table): bool { // check if object could be modelled - if (($items = $this->model->items($items, 'power')) !== null) + if (($items = $this->model->items($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->items($items, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->items($items, $key, $table); } return false; } diff --git a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.power b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.power index ce7cb37..89fdfc9 100644 --- a/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.power +++ b/src/d7a5f0c6-de60-4d31-b3e4-5d668a8f7d2e/code.power @@ -30,17 +30,18 @@ /** * Update a value to a given table - * Example: $this->value(Value, 'value_key', 'GUID'); + * Example: $this->value(Value, 'value_key', 'id', 'table_name'); * * @param mixed $value The field value * @param string $field The field key * @param string $keyValue The key value * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function value($value, string $field, string $keyValue, string $key = 'guid'): bool + public function value($value, string $field, string $keyValue, string $key, string $table): bool { // build the array $item = []; @@ -48,85 +49,93 @@ $item[$field] = $value; // Update the column of this table using guid as the primary key. - return $this->row($item); + return $this->row($item, $key, $table); } /** * Update single row with multiple values to a given table - * Example: $this->item(Array); + * Example: $this->item(Array, 'id', 'table_name'); * - * @param array $item The item to save + * @param array $item The item to save + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function row(array $item): bool + public function row(array $item, string $key, string $table): bool { // check if object could be modelled - if (($item = $this->model->row($item, 'power')) !== null) + if (($item = $this->model->row($item, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->row($item, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->row($item, $key, $table); } return false; } /** * Update multiple rows to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'id', 'table_name'); * - * @param array|null $items The items updated in database (array of arrays) + * @param array|null $items The items updated in database (array of arrays) + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function rows(?array $items): bool + public function rows(?array $items, string $key, string $table): bool { // check if object could be modelled - if (($items = $this->model->rows($items, 'power')) !== null) + if (($items = $this->model->rows($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->rows($items, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->rows($items, $key, $table); } return false; } /** * Update single item with multiple values to a given table - * Example: $this->item(Object); + * Example: $this->item(Object, 'id', 'table_name'); * * @param object $item The item to save + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function item(object $item): bool + public function item(object $item, string $key, string $table): bool { // check if object could be modelled - if (($item = $this->model->item($item, 'power')) !== null) + if (($item = $this->model->item($item, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->item($item, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->item($item, $key, $table); } return false; } /** * Update multiple items to a given table - * Example: $this->items(Array); + * Example: $this->items(Array, 'id', 'table_name'); * - * @param array|null $items The items updated in database (array of objects) + * @param array|null $items The items updated in database (array of objects) + * @param string $key The key name + * @param string $table Target table * * @return bool * @since 2.0.1 */ - public function items(?array $items): bool + public function items(?array $items, string $key, string $table): bool { // check if object could be modelled - if (($items = $this->model->items($items, 'power')) !== null) + if (($items = $this->model->items($items, $table)) !== null) { - // Update the column of this table using guid as the primary key. - return $this->database->items($items, 'guid', 'power'); + // Update the column of this table using $key as the primary key. + return $this->database->items($items, $key, $table); } return false; } \ No newline at end of file