update 2023-05-01 14:00:54
This commit is contained in:
parent
304e850c2a
commit
b33df41337
17
README.md
17
README.md
@ -51,7 +51,9 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **final class Update** | [Details](src/cce56585-58b0-4f72-a92c-e2635ea52d83) | [Code](src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php) | [Settings](src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json) | [cce56585-58b0-4f72-a92c-e2635ea52d83](src/cce56585-58b0-4f72-a92c-e2635ea52d83)
|
- **final class Update** | [Details](src/cce56585-58b0-4f72-a92c-e2635ea52d83) | [Code](src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php) | [Settings](src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json) | [cce56585-58b0-4f72-a92c-e2635ea52d83](src/cce56585-58b0-4f72-a92c-e2635ea52d83)
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
|
||||||
|
|
||||||
|
- **interface InsertInterface** | [Details](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48) | [Code](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php) | [Settings](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json) | [ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48)
|
||||||
- **interface ModelInterface** | [Details](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff) | [Code](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php) | [Settings](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json) | [8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff)
|
- **interface ModelInterface** | [Details](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff) | [Code](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php) | [Settings](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json) | [8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff)
|
||||||
|
- **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | [7179fde6-1e51-4b51-8545-7ca18f74a0f4](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4)
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities)
|
||||||
|
|
||||||
- **abstract class FilterHelper** | [Details](src/cddcac51-9a46-47c4-ba59-105c70453bd6) | [Code](src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php) | [Settings](src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json) | [cddcac51-9a46-47c4-ba59-105c70453bd6](src/cddcac51-9a46-47c4-ba59-105c70453bd6)
|
- **abstract class FilterHelper** | [Details](src/cddcac51-9a46-47c4-ba59-105c70453bd6) | [Code](src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php) | [Settings](src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json) | [cddcac51-9a46-47c4-ba59-105c70453bd6](src/cddcac51-9a46-47c4-ba59-105c70453bd6)
|
||||||
@ -327,6 +329,14 @@ namespace VDM\Joomla\Componentbuilder\Database #Olive {
|
|||||||
namespace VDM\Joomla\Componentbuilder\Interfaces #Olive {
|
namespace VDM\Joomla\Componentbuilder\Interfaces #Olive {
|
||||||
|
|
||||||
|
|
||||||
|
interface InsertInterface #Lavender {
|
||||||
|
+ defaults() : void
|
||||||
|
+ rows() : bool
|
||||||
|
+ items() : bool
|
||||||
|
+ row() : bool
|
||||||
|
+ item() : bool
|
||||||
|
}
|
||||||
|
|
||||||
interface ModelInterface #Lavender {
|
interface ModelInterface #Lavender {
|
||||||
+ value() : mixed
|
+ value() : mixed
|
||||||
+ item() : ?object
|
+ item() : ?object
|
||||||
@ -335,6 +345,13 @@ namespace VDM\Joomla\Componentbuilder\Interfaces #Olive {
|
|||||||
+ rows() : ?array
|
+ rows() : ?array
|
||||||
+ last() : ?int
|
+ last() : ?int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface UpdateInterface #Lavender {
|
||||||
|
+ rows() : bool
|
||||||
|
+ items() : bool
|
||||||
|
+ row() : bool
|
||||||
|
+ item() : bool
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,6 +65,11 @@ abstract class Database
|
|||||||
**/
|
**/
|
||||||
protected function quote($value)
|
protected function quote($value)
|
||||||
{
|
{
|
||||||
|
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
|
||||||
|
{
|
||||||
|
return 'NULL';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_numeric($value))
|
if (is_numeric($value))
|
||||||
{
|
{
|
||||||
if (filter_var($value, FILTER_VALIDATE_INT))
|
if (filter_var($value, FILTER_VALIDATE_INT))
|
||||||
@ -76,12 +81,18 @@ abstract class Database
|
|||||||
return (float) $value;
|
return (float) $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_bool($value))
|
elseif (is_bool($value)) // not sure if this will work well (but its correct)
|
||||||
{
|
{
|
||||||
return (int) $value;
|
return $value ? 'TRUE' : 'FALSE';
|
||||||
}
|
}
|
||||||
|
|
||||||
// default just escape it
|
// For date and datetime values
|
||||||
|
if ($value instanceof \DateTime)
|
||||||
|
{
|
||||||
|
return $this->db->quote($value->format('Y-m-d H:i:s'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// For other data types, just escape it
|
||||||
return $this->db->quote($value);
|
return $this->db->quote($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
**/
|
**/
|
||||||
protected function quote($value)
|
protected function quote($value)
|
||||||
{
|
{
|
||||||
|
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
|
||||||
|
{
|
||||||
|
return 'NULL';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_numeric($value))
|
if (is_numeric($value))
|
||||||
{
|
{
|
||||||
if (filter_var($value, FILTER_VALIDATE_INT))
|
if (filter_var($value, FILTER_VALIDATE_INT))
|
||||||
@ -51,12 +56,18 @@
|
|||||||
return (float) $value;
|
return (float) $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_bool($value))
|
elseif (is_bool($value)) // not sure if this will work well (but its correct)
|
||||||
{
|
{
|
||||||
return (int) $value;
|
return $value ? 'TRUE' : 'FALSE';
|
||||||
}
|
}
|
||||||
|
|
||||||
// default just escape it
|
// For date and datetime values
|
||||||
|
if ($value instanceof \DateTime)
|
||||||
|
{
|
||||||
|
return $this->db->quote($value->format('Y-m-d H:i:s'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// For other data types, just escape it
|
||||||
return $this->db->quote($value);
|
return $this->db->quote($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md
Normal file
83
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/README.md
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface UpdateInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface UpdateInterface #Lavender {
|
||||||
|
+ rows(array $data, string $key, ...) : bool
|
||||||
|
+ items(array $data, string $key, ...) : bool
|
||||||
|
+ row(array $data, string $key, ...) : bool
|
||||||
|
+ item(object $data, string $key, ...) : bool
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of UpdateInterface::rows
|
||||||
|
Update rows in the database (with remapping and filtering columns option)
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $data
|
||||||
|
string $key
|
||||||
|
string $table
|
||||||
|
array $columns = []
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of UpdateInterface::items
|
||||||
|
Update items in the database (with remapping and filtering columns option)
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $data
|
||||||
|
string $key
|
||||||
|
string $table
|
||||||
|
array $columns = []
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of UpdateInterface::row
|
||||||
|
Update row in the database
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $data
|
||||||
|
string $key
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of UpdateInterface::item
|
||||||
|
Update item in the database
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
object $data
|
||||||
|
string $key
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
73
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php
Normal file
73
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2022
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Update Interface
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
interface UpdateInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Update rows in the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to update in database [array of arrays (key => value)]
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function rows(array $data, string $key, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update items in the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Data to updated in database (array of objects)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being update
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function items(array $data, string $key, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update row in the database
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to update in database (key => value)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function row(array $data, string $key, string $table): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update item in the database
|
||||||
|
*
|
||||||
|
* @param object $data Dataset to update in database (key => value)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function item(object $data, string $key, string $table): bool;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
49
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power
Normal file
49
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.power
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* Update rows in the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to update in database [array of arrays (key => value)]
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function rows(array $data, string $key, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update items in the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Data to updated in database (array of objects)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being update
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function items(array $data, string $key, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update row in the database
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to update in database (key => value)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function row(array $data, string $key, string $table): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update item in the database
|
||||||
|
*
|
||||||
|
* @param object $data Dataset to update in database (key => value)
|
||||||
|
* @param string $key Dataset key column to use in updating the values in the Database
|
||||||
|
* @param string $table The table where the data is being updated
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function item(object $data, string $key, string $table): bool;
|
18
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json
Normal file
18
src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "0",
|
||||||
|
"guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "UpdateInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Interfaces.UpdateInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.UpdateInterface",
|
||||||
|
"description": "Database Update Interface\r\n\r\n@since 3.2.0",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||||
|
"head": "",
|
||||||
|
"composer": ""
|
||||||
|
}
|
79
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md
Normal file
79
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/README.md
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface InsertInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface InsertInterface #Lavender {
|
||||||
|
+ defaults(bool $trigger = true) : void
|
||||||
|
+ rows(array $data, string $table, ...) : bool
|
||||||
|
+ items(array $data, string $table, ...) : bool
|
||||||
|
+ row(array $data, string $table) : bool
|
||||||
|
+ item(object $data, string $table) : bool
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of InsertInterface::defaults
|
||||||
|
Switch to prevent/allow defaults from being added.
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of InsertInterface::rows
|
||||||
|
Insert rows to the database (with remapping and filtering columns option)
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $data
|
||||||
|
string $table
|
||||||
|
array $columns = []
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of InsertInterface::items
|
||||||
|
Insert items to the database (with remapping and filtering columns option)
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $data
|
||||||
|
string $table
|
||||||
|
array $columns = []
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of InsertInterface::row
|
||||||
|
Insert row to the database
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of InsertInterface::item
|
||||||
|
Insert item to the database
|
||||||
|
|
||||||
|
since: 3.2.0
|
||||||
|
return: bool
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
79
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php
Normal file
79
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2022
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Insert Interface
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
interface InsertInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Switch to prevent/allow defaults from being added.
|
||||||
|
*
|
||||||
|
* @param bool $trigger toggle the defaults
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function defaults(bool $trigger = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert rows to the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to store in database [array of arrays (key => value)]
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function rows(array $data, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert items to the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Data to store in database (array of objects)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function items(array $data, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert row to the database
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to store in database (key => value)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function row(array $data, string $table): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert item to the database
|
||||||
|
*
|
||||||
|
* @param object $data Dataset to store in database (key => value)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function item(object $data, string $table): bool;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
55
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power
Normal file
55
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.power
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* Switch to prevent/allow defaults from being added.
|
||||||
|
*
|
||||||
|
* @param bool $trigger toggle the defaults
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function defaults(bool $trigger = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert rows to the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to store in database [array of arrays (key => value)]
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function rows(array $data, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert items to the database (with remapping and filtering columns option)
|
||||||
|
*
|
||||||
|
* @param array $data Data to store in database (array of objects)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
* @param array $columns Data columns for remapping and filtering
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function items(array $data, string $table, array $columns = []): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert row to the database
|
||||||
|
*
|
||||||
|
* @param array $data Dataset to store in database (key => value)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function row(array $data, string $table): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert item to the database
|
||||||
|
*
|
||||||
|
* @param object $data Dataset to store in database (key => value)
|
||||||
|
* @param string $table The table where the data is being added
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 3.2.0
|
||||||
|
**/
|
||||||
|
public function item(object $data, string $table): bool;
|
18
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json
Normal file
18
src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "0",
|
||||||
|
"guid": "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "InsertInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Interfaces.InsertInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.InsertInterface",
|
||||||
|
"description": "Database Insert Interface\r\n\r\n@since 3.2.0",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||||
|
"head": "",
|
||||||
|
"composer": ""
|
||||||
|
}
|
@ -169,6 +169,16 @@
|
|||||||
"path": "src\/06f8eada-d59b-441c-b287-0aea1793da5a",
|
"path": "src\/06f8eada-d59b-441c-b287-0aea1793da5a",
|
||||||
"guid": "06f8eada-d59b-441c-b287-0aea1793da5a"
|
"guid": "06f8eada-d59b-441c-b287-0aea1793da5a"
|
||||||
},
|
},
|
||||||
|
"ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48": {
|
||||||
|
"name": "InsertInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/code.php",
|
||||||
|
"power": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/code.power",
|
||||||
|
"settings": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48\/settings.json",
|
||||||
|
"path": "src\/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48",
|
||||||
|
"guid": "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48"
|
||||||
|
},
|
||||||
"524eb8f6-38d4-47dc-92ad-98b94e099ac0": {
|
"524eb8f6-38d4-47dc-92ad-98b94e099ac0": {
|
||||||
"name": "Insert",
|
"name": "Insert",
|
||||||
"type": "final class",
|
"type": "final class",
|
||||||
@ -209,6 +219,16 @@
|
|||||||
"path": "src\/584747d1-3a86-453d-b7a3-a2219de8d777",
|
"path": "src\/584747d1-3a86-453d-b7a3-a2219de8d777",
|
||||||
"guid": "584747d1-3a86-453d-b7a3-a2219de8d777"
|
"guid": "584747d1-3a86-453d-b7a3-a2219de8d777"
|
||||||
},
|
},
|
||||||
|
"7179fde6-1e51-4b51-8545-7ca18f74a0f4": {
|
||||||
|
"name": "UpdateInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/code.php",
|
||||||
|
"power": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/code.power",
|
||||||
|
"settings": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4\/settings.json",
|
||||||
|
"path": "src\/7179fde6-1e51-4b51-8545-7ca18f74a0f4",
|
||||||
|
"guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4"
|
||||||
|
},
|
||||||
"cce56585-58b0-4f72-a92c-e2635ea52d83": {
|
"cce56585-58b0-4f72-a92c-e2635ea52d83": {
|
||||||
"name": "Update",
|
"name": "Update",
|
||||||
"type": "final class",
|
"type": "final class",
|
||||||
|
Loading…
Reference in New Issue
Block a user