forked from joomla/super-powers
Update 2024-10-18 02:15:11
This commit is contained in:
parent
98710c7fbd
commit
e3096c796e
16
README.md
16
README.md
@ -68,7 +68,8 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
|
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
|
||||||
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
|
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
|
||||||
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`
|
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`
|
||||||
- **interface Tableinterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
- **interface TableInterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
||||||
|
- **interface TableValidatorInterface** | [Details](src/feb3affa-5102-4307-93db-04525f4c66f0) | [Code](src/feb3affa-5102-4307-93db-04525f4c66f0/code.php) | [Settings](src/feb3affa-5102-4307-93db-04525f4c66f0/settings.json) | SPK: `Super---feb3affa_5102_4307_93db_04525f4c66f0---Power`
|
||||||
- **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) | SPK: `Super---7179fde6_1e51_4b51_8545_7ca18f74a0f4---Power`
|
- **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) | SPK: `Super---7179fde6_1e51_4b51_8545_7ca18f74a0f4---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
|
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
|
||||||
|
|
||||||
@ -118,6 +119,16 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Import](#vdm-joomla-componentbuilder-import)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Import](#vdm-joomla-componentbuilder-import)
|
||||||
|
|
||||||
- **abstract class Factory** | [Details](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068) | [Code](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php) | [Settings](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/settings.json) | SPK: `Super---ff8d5fdb_2d1f_4178_bd18_a43b8efd1068---Power`
|
- **abstract class Factory** | [Details](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068) | [Code](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php) | [Settings](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/settings.json) | SPK: `Super---ff8d5fdb_2d1f_4178_bd18_a43b8efd1068---Power`
|
||||||
|
- **final class Item** | [Details](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7) | [Code](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php) | [Settings](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json) | SPK: `Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power`
|
||||||
|
- **final class Message** | [Details](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0) | [Code](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php) | [Settings](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json) | SPK: `Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power`
|
||||||
|
- **final class Row** | [Details](src/afb5b891-7130-422a-b389-1934b0e4fc48) | [Code](src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php) | [Settings](src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json) | SPK: `Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power`
|
||||||
|
- **final class Status** | [Details](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459) | [Code](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php) | [Settings](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json) | SPK: `Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
|
||||||
|
|
||||||
|
- **interface ImportItemInterface** | [Details](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856) | [Code](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php) | [Settings](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json) | SPK: `Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power`
|
||||||
|
- **interface ImportMessageInterface** | [Details](src/23ad6e72-1b82-40fb-836c-50da690bb174) | [Code](src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php) | [Settings](src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json) | SPK: `Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power`
|
||||||
|
- **interface ImportRowInterface** | [Details](src/3d3ec064-9867-41e6-a48a-964c15d753aa) | [Code](src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php) | [Settings](src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json) | SPK: `Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power`
|
||||||
|
- **interface ImportStatusInterface** | [Details](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f) | [Code](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php) | [Settings](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json) | SPK: `Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
|
||||||
|
|
||||||
- **class Spreadsheet** | [Details](src/c4a188de-ad78-4a6d-9d5b-01866846d701) | [Code](src/c4a188de-ad78-4a6d-9d5b-01866846d701/code.php) | [Settings](src/c4a188de-ad78-4a6d-9d5b-01866846d701/settings.json) | SPK: `Super---c4a188de_ad78_4a6d_9d5b_01866846d701---Power`
|
- **class Spreadsheet** | [Details](src/c4a188de-ad78-4a6d-9d5b-01866846d701) | [Code](src/c4a188de-ad78-4a6d-9d5b-01866846d701/code.php) | [Settings](src/c4a188de-ad78-4a6d-9d5b-01866846d701/settings.json) | SPK: `Super---c4a188de_ad78_4a6d_9d5b_01866846d701---Power`
|
||||||
@ -187,6 +198,9 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\File\Service](#vdm-joomla-componentbuilder-file-service)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\File\Service](#vdm-joomla-componentbuilder-file-service)
|
||||||
|
|
||||||
- **class File** | [Details](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088) | [Code](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php) | [Settings](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json) | SPK: `Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power`
|
- **class File** | [Details](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088) | [Code](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php) | [Settings](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json) | SPK: `Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Import\Service](#vdm-joomla-componentbuilder-import-service)
|
||||||
|
|
||||||
|
- **class Import** | [Details](src/21754a8b-2323-4a77-8459-378a74c1ec97) | [Code](src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php) | [Settings](src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json) | SPK: `Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet](#vdm-joomla-componentbuilder-interfaces-spreadsheet)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet](#vdm-joomla-componentbuilder-interfaces-spreadsheet)
|
||||||
|
|
||||||
- **interface FileReaderInterface** | [Details](src/61d1146f-2c2e-4e42-8492-d076f945cf35) | [Code](src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.php) | [Settings](src/61d1146f-2c2e-4e42-8492-d076f945cf35/settings.json) | SPK: `Super---61d1146f_2c2e_4e42_8492_d076f945cf35---Power`
|
- **interface FileReaderInterface** | [Details](src/61d1146f-2c2e-4e42-8492-d076f945cf35) | [Code](src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.php) | [Settings](src/61d1146f-2c2e-4e42-8492-d076f945cf35/settings.json) | SPK: `Super---61d1146f_2c2e_4e42_8492_d076f945cf35---Power`
|
||||||
|
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportStatusInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportStatusInterface #Lavender {
|
||||||
|
+ set(int $status, string $guid) : void
|
||||||
|
+ table(string $table) : self
|
||||||
|
+ field(string $fieldName) : self
|
||||||
|
+ getTable() : string
|
||||||
|
+ getField() : string
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::set
|
||||||
|
Updates the status in the database.
|
||||||
|
This method updates the import status in the database based on the result of the import process.
|
||||||
|
Status codes:
|
||||||
|
- 2: Being Processed.
|
||||||
|
- 3: Import completed successfully.
|
||||||
|
- 4: Import completed with errors.
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::table
|
||||||
|
Set the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::field
|
||||||
|
Set the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::getTable
|
||||||
|
Get the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::getField
|
||||||
|
Get the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal file
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Status Interface
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
interface ImportStatusInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string;
|
||||||
|
}
|
||||||
|
|
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string;
|
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportStatusInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportStatusInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportStatusInterface",
|
||||||
|
"description": "Import Status Interface\r\n\r\n@since 3.2.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
84
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
84
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class Import (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import\Service**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Import #Gold {
|
||||||
|
+ register(Container $container) : void
|
||||||
|
+ getRow(Container $container) : Row
|
||||||
|
+ getItem(Container $container) : Item
|
||||||
|
+ getMessage(Container $container) : Message
|
||||||
|
+ getStatus(Container $container) : Status
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Import::register
|
||||||
|
Registers the service provider with a DI container.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getRow
|
||||||
|
Get The Row Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Row
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getItem
|
||||||
|
Get The Item Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Item
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getMessage
|
||||||
|
Get The Message Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Message
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getStatus
|
||||||
|
Get The Status Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Status
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
114
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
114
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?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\Import\Service;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Row;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Item;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Message;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Status;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Service Provider
|
||||||
|
*
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
class Import implements ServiceProviderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Row::class, 'Import.Row')
|
||||||
|
->share('Import.Row', [$this, 'getRow'], true);
|
||||||
|
|
||||||
|
$container->alias(Item::class, 'Import.Item')
|
||||||
|
->share('Import.Item', [$this, 'getItem'], true);
|
||||||
|
|
||||||
|
$container->alias(Message::class, 'Import.Message')
|
||||||
|
->share('Import.Message', [$this, 'getMessage'], true);
|
||||||
|
|
||||||
|
$container->alias(Status::class, 'Import.Status')
|
||||||
|
->share('Import.Status', [$this, 'getStatus'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Row Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Row
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getRow(Container $container): Row
|
||||||
|
{
|
||||||
|
return new Row();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Item Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Item
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getItem(Container $container): Item
|
||||||
|
{
|
||||||
|
return new Item(
|
||||||
|
$container->get('Table.Validator'),
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Import.Row')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Message Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMessage(Container $container): Message
|
||||||
|
{
|
||||||
|
return new Message(
|
||||||
|
$container->get('Data.Update'),
|
||||||
|
$container->get('Data.Insert')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Status Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Status
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getStatus(Container $container): Status
|
||||||
|
{
|
||||||
|
return new Status(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
83
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
83
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Row::class, 'Import.Row')
|
||||||
|
->share('Import.Row', [$this, 'getRow'], true);
|
||||||
|
|
||||||
|
$container->alias(Item::class, 'Import.Item')
|
||||||
|
->share('Import.Item', [$this, 'getItem'], true);
|
||||||
|
|
||||||
|
$container->alias(Message::class, 'Import.Message')
|
||||||
|
->share('Import.Message', [$this, 'getMessage'], true);
|
||||||
|
|
||||||
|
$container->alias(Status::class, 'Import.Status')
|
||||||
|
->share('Import.Status', [$this, 'getStatus'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Row Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Row
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getRow(Container $container): Row
|
||||||
|
{
|
||||||
|
return new Row();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Item Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Item
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getItem(Container $container): Item
|
||||||
|
{
|
||||||
|
return new Item(
|
||||||
|
$container->get('Table.Validator'),
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Import.Row')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Message Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMessage(Container $container): Message
|
||||||
|
{
|
||||||
|
return new Message(
|
||||||
|
$container->get('Data.Update'),
|
||||||
|
$container->get('Data.Insert')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Status Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Status
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getStatus(Container $container): Status
|
||||||
|
{
|
||||||
|
return new Status(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
39
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
39
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"add_head": "1",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "21754a8b-2323-4a77-8459-378a74c1ec97",
|
||||||
|
"implements": [
|
||||||
|
"-1"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Import",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Service.Import",
|
||||||
|
"type": "class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "afb5b891-7130-422a-b389-1934b0e4fc48",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "d2a859ac-3f2a-4f69-a77f-f118b2e0a459",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Service.Import",
|
||||||
|
"description": "Import Service Provider\r\n\r\n@since 5.0.3",
|
||||||
|
"implements_custom": "ServiceProviderInterface",
|
||||||
|
"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": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||||
|
"composer": ""
|
||||||
|
}
|
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportMessageInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportMessageInterface #Lavender {
|
||||||
|
+ load(string $guid, string $entity, ...) : self
|
||||||
|
+ get() : object
|
||||||
|
+ reset() : void
|
||||||
|
+ archive() : self
|
||||||
|
+ set() : self
|
||||||
|
+ addSuccess(string $message) : self
|
||||||
|
+ addInfo(string $message) : self
|
||||||
|
+ addError(string $message) : self
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::load
|
||||||
|
Load an entity that these message belong to
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $guid
|
||||||
|
string $entity
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::get
|
||||||
|
Get the messages of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::reset
|
||||||
|
Reset the messages of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::archive
|
||||||
|
Archive the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::set
|
||||||
|
Set the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::addSuccess
|
||||||
|
Adds a success message to the log.
|
||||||
|
This method records a success message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the success rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::addInfo
|
||||||
|
Adds a info message to the log.
|
||||||
|
This method records a info message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the info rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::addError
|
||||||
|
Adds an error message to the log.
|
||||||
|
This method records an error message when the import process encounters issues.
|
||||||
|
The message includes details about the failures, such as the number of failed rows
|
||||||
|
and the corresponding error rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Message Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
interface ImportMessageInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self;
|
||||||
|
}
|
||||||
|
|
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self;
|
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportMessageInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportMessageInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportMessageInterface",
|
||||||
|
"description": "Import Message Interface\r\n\r\n@since 3.0.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -6,12 +6,12 @@
|
|||||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
```
|
```
|
||||||
# interface Tableinterface (Details)
|
# interface TableInterface (Details)
|
||||||
> namespace: **VDM\Joomla\Interfaces**
|
> namespace: **VDM\Joomla\Interfaces**
|
||||||
|
|
||||||
```uml
|
```uml
|
||||||
@startuml
|
@startuml
|
||||||
interface Tableinterface #Lavender {
|
interface TableInterface #Lavender {
|
||||||
+ get(?string $table = null, ?string $field = null, ...) : mixed
|
+ get(?string $table = null, ?string $field = null, ...) : mixed
|
||||||
+ title(string $table) : ?array
|
+ title(string $table) : ?array
|
||||||
+ titleName(string $table) : string
|
+ titleName(string $table) : string
|
||||||
@ -20,7 +20,7 @@ interface Tableinterface #Lavender {
|
|||||||
+ fields(string $table, bool $default = false, ...) : ?array
|
+ fields(string $table, bool $default = false, ...) : ?array
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of Tableinterface::get
|
note right of TableInterface::get
|
||||||
Get any value from a item/field/column of an area/view/table
|
Get any value from a item/field/column of an area/view/table
|
||||||
Example: $this->get('table_name', 'field_name', 'value_key');
|
Example: $this->get('table_name', 'field_name', 'value_key');
|
||||||
Get an item/field/column of an area/view/table
|
Get an item/field/column of an area/view/table
|
||||||
@ -40,35 +40,35 @@ Example: $this->get();
|
|||||||
?string $key = null
|
?string $key = null
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::title
|
note right of TableInterface::title
|
||||||
Get title field from an area/view/table
|
Get title field from an area/view/table
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: ?array
|
return: ?array
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::titleName
|
note right of TableInterface::titleName
|
||||||
Get title field name
|
Get title field name
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: string
|
return: string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::tables
|
note right of TableInterface::tables
|
||||||
Get all tables
|
Get all tables
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: array
|
return: array
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::exist
|
note right of TableInterface::exist
|
||||||
Check if a table (and field) exist
|
Check if a table (and field) exist
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::fields
|
note right of TableInterface::fields
|
||||||
Get all fields of an area/view/table
|
Get all fields of an area/view/table
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Interfaces;
|
|||||||
/**
|
/**
|
||||||
* The VDM Core Table Interface
|
* The VDM Core Table Interface
|
||||||
*/
|
*/
|
||||||
interface Tableinterface
|
interface TableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get any value from a item/field/column of an area/view/table
|
* Get any value from a item/field/column of an area/view/table
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
"guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
|
"guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
"load_selection": null,
|
"load_selection": null,
|
||||||
"name": "Tableinterface",
|
"name": "TableInterface",
|
||||||
"power_version": "1.0.0",
|
"power_version": "1.0.0",
|
||||||
"system_name": "VDM.Interfaces.Tableinterface",
|
"system_name": "VDM.Interfaces.TableInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
"use_selection": null,
|
"use_selection": null,
|
||||||
"extendsinterfaces": null,
|
"extendsinterfaces": null,
|
||||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.Tableinterface",
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.TableInterface",
|
||||||
"description": "The VDM Core Table Interface",
|
"description": "The VDM Core Table Interface",
|
||||||
"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",
|
"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": "",
|
"head": "",
|
||||||
|
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportRowInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportRowInterface #Lavender {
|
||||||
|
+ set(int $index, array $values) : void
|
||||||
|
+ clear() : self
|
||||||
|
+ getIndex() : int
|
||||||
|
+ getValue(string $key) : mixed
|
||||||
|
+ unsetValue(string $key) : void
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportRowInterface::set
|
||||||
|
Set the row details
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::clear
|
||||||
|
Clear the row details
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::getIndex
|
||||||
|
Get Index
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: int
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::getValue
|
||||||
|
Get Value
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: mixed
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::unsetValue
|
||||||
|
Unset Value
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Row Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
interface ImportRowInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function clear(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getIndex(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getValue(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void;
|
||||||
|
}
|
||||||
|
|
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function clear(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getIndex(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getValue(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void;
|
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportRowInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportRowInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportRowInterface",
|
||||||
|
"description": "Import Row Interface\r\n\r\n@since 3.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
52
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/README.md
Normal file
52
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportItemInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportItemInterface #Lavender {
|
||||||
|
+ get(string $table, array $columns) : ?array
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportItemInterface::get
|
||||||
|
Get the item from the import row values and ensure it is valid
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
33
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php
Normal file
33
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Item Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
interface ImportItemInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the item from the import row values and ensure it is valid
|
||||||
|
*
|
||||||
|
* @param string $table The table these columns belongs to.
|
||||||
|
* @param array $columns The columns to extract.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function get(string $table, array $columns): ?array;
|
||||||
|
}
|
||||||
|
|
10
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.power
Normal file
10
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.power
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Get the item from the import row values and ensure it is valid
|
||||||
|
*
|
||||||
|
* @param string $table The table these columns belongs to.
|
||||||
|
* @param array $columns The columns to extract.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function get(string $table, array $columns): ?array;
|
19
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json
Normal file
19
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "53f55e5b-63cb-49e7-b1e6-33e7a9f97856",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportItemInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportItemInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportItemInterface",
|
||||||
|
"description": "Import Item Interface\r\n\r\n@since 3.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -14,7 +14,7 @@ namespace VDM\Joomla\Abstraction;
|
|||||||
|
|
||||||
use VDM\Joomla\Utilities\StringHelper;
|
use VDM\Joomla\Utilities\StringHelper;
|
||||||
use VDM\Joomla\Utilities\ArrayHelper;
|
use VDM\Joomla\Utilities\ArrayHelper;
|
||||||
use VDM\Joomla\Interfaces\Tableinterface as Table;
|
use VDM\Joomla\Interfaces\TableInterface as Table;
|
||||||
use VDM\Joomla\Interfaces\ModelInterface;
|
use VDM\Joomla\Interfaces\ModelInterface;
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace VDM\Joomla\Abstraction;
|
|||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use VDM\Joomla\Interfaces\SchemaInterface as Schema;
|
use VDM\Joomla\Interfaces\SchemaInterface as Schema;
|
||||||
use VDM\Joomla\Interfaces\Tableinterface as Table;
|
use VDM\Joomla\Interfaces\TableInterface as Table;
|
||||||
use VDM\Joomla\Utilities\ClassHelper;
|
use VDM\Joomla\Utilities\ClassHelper;
|
||||||
use VDM\Joomla\Interfaces\SchemaCheckerInterface;
|
use VDM\Joomla\Interfaces\SchemaCheckerInterface;
|
||||||
|
|
||||||
|
134
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/README.md
Normal file
134
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/README.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Item (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Item << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Validator $validator
|
||||||
|
# Item $item
|
||||||
|
# Row $row
|
||||||
|
+ __construct(Validator $validator, Item $item, ...)
|
||||||
|
+ get(string $table, array $columns) : ?array
|
||||||
|
- getImportValue(mixed $value, string $field, ...) : mixed
|
||||||
|
- validImportValue(mixed $value, string $field, ...) : mixed
|
||||||
|
- getLocalValue(mixed $value, array $link) : mixed|null
|
||||||
|
- isValueExists(mixed $value, array $link) : bool
|
||||||
|
- setLocalValue(mixed $value, array $link) : mixed|null
|
||||||
|
- insertItemWithGuid(mixed $value, array $link) : ?string
|
||||||
|
- insertItemWithId(mixed $value, array $link) : mixed|null
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Item::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Validator $validator
|
||||||
|
Item $item
|
||||||
|
Row $row
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Item::get
|
||||||
|
Get the item from the import row values and ensure it is valid
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Item::getImportValue
|
||||||
|
Get the correct value needed for the import of the related row (item).
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: mixed
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
mixed $value
|
||||||
|
string $field
|
||||||
|
string $table
|
||||||
|
?array $link
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Item::validImportValue
|
||||||
|
Make sure we have a valid import value
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: mixed
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
mixed $value
|
||||||
|
string $field
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Item::getLocalValue
|
||||||
|
Helper function to get the local value from the database table.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: mixed|null
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Item::isValueExists
|
||||||
|
Check if the value exists in the table for the given link.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: bool
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Item::setLocalValue
|
||||||
|
Create a new value in the database table if it doesn't already exist.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: mixed|null
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Item::insertItemWithGuid
|
||||||
|
Insert a new item with a GUID.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: ?string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Item::insertItemWithId
|
||||||
|
Insert a new item with a non-numeric ID.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: mixed|null
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
269
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php
Normal file
269
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
<?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\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\TableValidatorInterface as Validator;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportRowInterface as Row;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportItemInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Item Class
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
final class Item implements ImportItemInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Table Validator Class.
|
||||||
|
*
|
||||||
|
* @var Validator
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Validator $validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Row Class.
|
||||||
|
*
|
||||||
|
* @var Row
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Row $row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Validator $validator The Table ValidatorI Class.
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
* @param Row $row The Import Row Class.
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function __construct(Validator $validator, Item $item, Row $row)
|
||||||
|
{
|
||||||
|
$this->validator = $validator;
|
||||||
|
$this->item = $item;
|
||||||
|
$this->row = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the item from the import row values and ensure it is valid
|
||||||
|
*
|
||||||
|
* @param string $table The table these columns belongs to.
|
||||||
|
* @param array $columns The columns to extract.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function get(string $table, array $columns): ?array
|
||||||
|
{
|
||||||
|
$item = [];
|
||||||
|
foreach ($columns as $column => $map)
|
||||||
|
{
|
||||||
|
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
|
||||||
|
{
|
||||||
|
// get the valid importable value
|
||||||
|
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
|
||||||
|
|
||||||
|
// remove value from global row values set
|
||||||
|
$this->row->unsetValue($column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $item ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the correct value needed for the import of the related row (item).
|
||||||
|
*
|
||||||
|
* @param mixed $value The value from the row.
|
||||||
|
* @param string $field The field name where the value is being stored.
|
||||||
|
* @param string $table The table this field belongs to.
|
||||||
|
* @param array $link The field link values.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function getImportValue($value, string $field, string $table, ?array $link)
|
||||||
|
{
|
||||||
|
// Validate the link array and return the original value if invalid
|
||||||
|
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
|
||||||
|
{
|
||||||
|
return $this->validImportValue($value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle GUID key with validation via GuidHelper
|
||||||
|
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle numeric ID with validation
|
||||||
|
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
|
||||||
|
{
|
||||||
|
return (int) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to retrieve the local value
|
||||||
|
$local_value = $this->getLocalValue($value, $link);
|
||||||
|
|
||||||
|
// If no local value exists, create it if necessary
|
||||||
|
if ($local_value === null)
|
||||||
|
{
|
||||||
|
$local_value = $this->setLocalValue($value, $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->validImportValue($local_value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure we have a valid import value
|
||||||
|
*
|
||||||
|
* @param mixed $value The value.
|
||||||
|
* @param string $field The field name where the value is being stored.
|
||||||
|
* @param string $table The table this field belongs to.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function validImportValue($value, string $field, string $table)
|
||||||
|
{
|
||||||
|
// make sure our value will fit in the database table datatype
|
||||||
|
return $this->validator->getValid($value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to get the local value from the database table.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to search for.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The local value or null if not found.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function getLocalValue($value, array $link)
|
||||||
|
{
|
||||||
|
// Attempt to retrieve the value based on the link['value'] and link['key']
|
||||||
|
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||||
|
|
||||||
|
// If not found, try retrieving by link['key'] and link['key']
|
||||||
|
if ($local_value === null && $this->isValueExists($value, $link))
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $local_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the value exists in the table for the given link.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to check.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return bool True if the value exists, false otherwise.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function isValueExists($value, array $link): bool
|
||||||
|
{
|
||||||
|
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new value in the database table if it doesn't already exist.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to create.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The newly created value or null if creation failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function setLocalValue($value, array $link)
|
||||||
|
{
|
||||||
|
// Handle GUID creation if the provided value is not valid
|
||||||
|
if ($link['key'] === 'guid')
|
||||||
|
{
|
||||||
|
if (!GuidHelper::valid($value))
|
||||||
|
{
|
||||||
|
return $this->insertItemWithGuid($value, $link);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle ID creation
|
||||||
|
if ($link['key'] === 'id')
|
||||||
|
{
|
||||||
|
if (!is_numeric($value))
|
||||||
|
{
|
||||||
|
return $this->insertItemWithId($value, $link);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// could not create local item (we don't have enough details)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new item with a GUID.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to insert.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return string|null The new GUID or null if insertion failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function insertItemWithGuid($value, array $link): ?string
|
||||||
|
{
|
||||||
|
$guid = GuidHelper::get();
|
||||||
|
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
|
||||||
|
|
||||||
|
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||||
|
{
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new item with a non-numeric ID.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to insert.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The new ID or null if insertion failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function insertItemWithId($value, array $link)
|
||||||
|
{
|
||||||
|
$item = (object) [$link['key'] => 0, $link['value'] => $value];
|
||||||
|
|
||||||
|
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||||
|
{
|
||||||
|
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
240
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.power
Normal file
240
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.power
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
/**
|
||||||
|
* The Table Validator Class.
|
||||||
|
*
|
||||||
|
* @var Validator
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Validator $validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Row Class.
|
||||||
|
*
|
||||||
|
* @var Row
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Row $row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Validator $validator The Table ValidatorI Class.
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
* @param Row $row The Import Row Class.
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function __construct(Validator $validator, Item $item, Row $row)
|
||||||
|
{
|
||||||
|
$this->validator = $validator;
|
||||||
|
$this->item = $item;
|
||||||
|
$this->row = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the item from the import row values and ensure it is valid
|
||||||
|
*
|
||||||
|
* @param string $table The table these columns belongs to.
|
||||||
|
* @param array $columns The columns to extract.
|
||||||
|
*
|
||||||
|
* @return array|null
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function get(string $table, array $columns): ?array
|
||||||
|
{
|
||||||
|
$item = [];
|
||||||
|
foreach ($columns as $column => $map)
|
||||||
|
{
|
||||||
|
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
|
||||||
|
{
|
||||||
|
// get the valid importable value
|
||||||
|
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
|
||||||
|
|
||||||
|
// remove value from global row values set
|
||||||
|
$this->row->unsetValue($column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $item ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the correct value needed for the import of the related row (item).
|
||||||
|
*
|
||||||
|
* @param mixed $value The value from the row.
|
||||||
|
* @param string $field The field name where the value is being stored.
|
||||||
|
* @param string $table The table this field belongs to.
|
||||||
|
* @param array $link The field link values.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function getImportValue($value, string $field, string $table, ?array $link)
|
||||||
|
{
|
||||||
|
// Validate the link array and return the original value if invalid
|
||||||
|
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
|
||||||
|
{
|
||||||
|
return $this->validImportValue($value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle GUID key with validation via GuidHelper
|
||||||
|
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle numeric ID with validation
|
||||||
|
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
|
||||||
|
{
|
||||||
|
return (int) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to retrieve the local value
|
||||||
|
$local_value = $this->getLocalValue($value, $link);
|
||||||
|
|
||||||
|
// If no local value exists, create it if necessary
|
||||||
|
if ($local_value === null)
|
||||||
|
{
|
||||||
|
$local_value = $this->setLocalValue($value, $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->validImportValue($local_value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure we have a valid import value
|
||||||
|
*
|
||||||
|
* @param mixed $value The value.
|
||||||
|
* @param string $field The field name where the value is being stored.
|
||||||
|
* @param string $table The table this field belongs to.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function validImportValue($value, string $field, string $table)
|
||||||
|
{
|
||||||
|
// make sure our value will fit in the database table datatype
|
||||||
|
return $this->validator->getValid($value, $field, $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to get the local value from the database table.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to search for.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The local value or null if not found.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function getLocalValue($value, array $link)
|
||||||
|
{
|
||||||
|
// Attempt to retrieve the value based on the link['value'] and link['key']
|
||||||
|
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||||
|
|
||||||
|
// If not found, try retrieving by link['key'] and link['key']
|
||||||
|
if ($local_value === null && $this->isValueExists($value, $link))
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $local_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the value exists in the table for the given link.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to check.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return bool True if the value exists, false otherwise.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function isValueExists($value, array $link): bool
|
||||||
|
{
|
||||||
|
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new value in the database table if it doesn't already exist.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to create.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The newly created value or null if creation failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function setLocalValue($value, array $link)
|
||||||
|
{
|
||||||
|
// Handle GUID creation if the provided value is not valid
|
||||||
|
if ($link['key'] === 'guid')
|
||||||
|
{
|
||||||
|
if (!GuidHelper::valid($value))
|
||||||
|
{
|
||||||
|
return $this->insertItemWithGuid($value, $link);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle ID creation
|
||||||
|
if ($link['key'] === 'id')
|
||||||
|
{
|
||||||
|
if (!is_numeric($value))
|
||||||
|
{
|
||||||
|
return $this->insertItemWithId($value, $link);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// could not create local item (we don't have enough details)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new item with a GUID.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to insert.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return string|null The new GUID or null if insertion failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function insertItemWithGuid($value, array $link): ?string
|
||||||
|
{
|
||||||
|
$guid = GuidHelper::get();
|
||||||
|
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
|
||||||
|
|
||||||
|
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||||
|
{
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new item with a non-numeric ID.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to insert.
|
||||||
|
* @param array $link The field link details.
|
||||||
|
*
|
||||||
|
* @return mixed|null The new ID or null if insertion failed.
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private function insertItemWithId($value, array $link)
|
||||||
|
{
|
||||||
|
$item = (object) [$link['key'] => 0, $link['value'] => $value];
|
||||||
|
|
||||||
|
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||||
|
{
|
||||||
|
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
34
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json
Normal file
34
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||||
|
"implements": [
|
||||||
|
"53f55e5b-63cb-49e7-b1e6-33e7a9f97856"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Item",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Item",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "feb3affa-5102-4307-93db-04525f4c66f0",
|
||||||
|
"as": "Validator"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
|
"as": "Item"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||||
|
"as": "Row"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Item",
|
||||||
|
"description": "Import Item Class\r\n\r\n@since 4.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -14,12 +14,15 @@
|
|||||||
class Validator << (F,LightGreen) >> #RoyalBlue {
|
class Validator << (F,LightGreen) >> #RoyalBlue {
|
||||||
# Table $table
|
# Table $table
|
||||||
# array $validators
|
# array $validators
|
||||||
|
# array $defaults
|
||||||
+ __construct(Table $table)
|
+ __construct(Table $table)
|
||||||
+ getValid(mixed $value, string $field, ...) : mixed
|
+ getValid(mixed $value, string $field, ...) : mixed
|
||||||
- validate(mixed $value, array $dbField) : bool
|
- validate(mixed $value, array $dbField) : bool
|
||||||
- getDefault(array $dbField) : mixed
|
- getDefault(array $dbField, mixed $value) : mixed
|
||||||
- parseDataType(string $datatype) : array
|
- parseDataType(string $datatype) : array
|
||||||
- getDatabaseField(string $field, string $table) : array
|
- getDatabaseField(string $field, string $table) : array
|
||||||
|
- registerValidators() : void
|
||||||
|
- registerDefaults() : void
|
||||||
- validateInteger(mixed $value, array $typeInfo) : bool
|
- validateInteger(mixed $value, array $typeInfo) : bool
|
||||||
- validateString(mixed $value, array $typeInfo) : bool
|
- validateString(mixed $value, array $typeInfo) : bool
|
||||||
- validateText(mixed $value, array $typeInfo) : bool
|
- validateText(mixed $value, array $typeInfo) : bool
|
||||||
@ -80,6 +83,20 @@ In your case, you use `$db = $this->table->get($table, $field, 'db')`.
|
|||||||
return: array
|
return: array
|
||||||
end note
|
end note
|
||||||
|
|
||||||
|
note right of Validator::registerValidators
|
||||||
|
Register validators for MySQL data types.
|
||||||
|
|
||||||
|
since: 5.3.0
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Validator::registerDefaults
|
||||||
|
Register default values for MySQL data types.
|
||||||
|
|
||||||
|
since: 5.3.0
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
note right of Validator::validateInteger
|
note right of Validator::validateInteger
|
||||||
Validate integer types (including tinyint, smallint, mediumint, etc.).
|
Validate integer types (including tinyint, smallint, mediumint, etc.).
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Table;
|
|||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Componentbuilder\Table;
|
use VDM\Joomla\Componentbuilder\Table;
|
||||||
|
use VDM\Joomla\Interfaces\TableValidatorInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Table;
|
|||||||
*
|
*
|
||||||
* @since 5.3.0
|
* @since 5.3.0
|
||||||
*/
|
*/
|
||||||
final class Validator
|
final class Validator implements TableValidatorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The Table Class.
|
* The Table Class.
|
||||||
@ -38,6 +39,14 @@ final class Validator
|
|||||||
*/
|
*/
|
||||||
protected array $validators = [];
|
protected array $validators = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of defauts for the respective datatypes.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
protected array $defaults = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@ -50,28 +59,10 @@ final class Validator
|
|||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
|
|
||||||
// Register datatype validators (mapping MySQL types to handlers)
|
// Register datatype validators (mapping MySQL types to handlers)
|
||||||
$this->validators = [
|
$this->registerValidators();
|
||||||
'int' => [$this, 'validateInteger'],
|
|
||||||
'tinyint' => [$this, 'validateInteger'],
|
// Register datatype defaults
|
||||||
'smallint' => [$this, 'validateInteger'],
|
$this->registerDefaults();
|
||||||
'mediumint' => [$this, 'validateInteger'],
|
|
||||||
'bigint' => [$this, 'validateInteger'],
|
|
||||||
'varchar' => [$this, 'validateString'],
|
|
||||||
'char' => [$this, 'validateString'],
|
|
||||||
'text' => [$this, 'validateText'],
|
|
||||||
'tinytext' => [$this, 'validateText'],
|
|
||||||
'mediumtext' => [$this, 'validateText'],
|
|
||||||
'longtext' => [$this, 'validateText'],
|
|
||||||
'decimal' => [$this, 'validateDecimal'],
|
|
||||||
'float' => [$this, 'validateFloat'],
|
|
||||||
'double' => [$this, 'validateFloat'],
|
|
||||||
'date' => [$this, 'validateDate'],
|
|
||||||
'datetime' => [$this, 'validateDate'],
|
|
||||||
'timestamp' => [$this, 'validateDate'],
|
|
||||||
'time' => [$this, 'validateDate'],
|
|
||||||
'json' => [$this, 'validateJson'],
|
|
||||||
'blob' => [$this, 'validateBlob'],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +92,7 @@ final class Validator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If invalid, return default, NULL (if allowed), or empty string
|
// If invalid, return default, NULL (if allowed), or empty string
|
||||||
return $this->getDefault($dbField);
|
return $this->getDefault($dbField, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,16 +125,20 @@ final class Validator
|
|||||||
* Handle returning the default value, null, or empty string if validation fails.
|
* Handle returning the default value, null, or empty string if validation fails.
|
||||||
*
|
*
|
||||||
* @param array $dbField The database field details.
|
* @param array $dbField The database field details.
|
||||||
|
* @param mixed $value The value to validate.
|
||||||
*
|
*
|
||||||
* @return mixed The default value, null, or empty string based on field settings.
|
* @return mixed The default value, null, or empty string based on field settings.
|
||||||
* @since 5.3.0
|
* @since 5.3.0
|
||||||
*/
|
*/
|
||||||
private function getDefault(array $dbField)
|
private function getDefault(array $dbField, $value)
|
||||||
{
|
{
|
||||||
|
// get default value from field db
|
||||||
|
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
|
||||||
|
|
||||||
// If a default value is provided, return it
|
// If a default value is provided, return it
|
||||||
if (!empty($dbField['default']))
|
if ($db_default !== null)
|
||||||
{
|
{
|
||||||
return strtoupper($dbField['default']) === 'EMPTY' ? '' : $dbField['default'];
|
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if NULL is allowed
|
// Check if NULL is allowed
|
||||||
@ -152,8 +147,9 @@ final class Validator
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no default value, return an empty string
|
// Fallback to datatype default
|
||||||
return '';
|
$typeInfo = $this->parseDataType($dbField['type']);
|
||||||
|
return $this->defaults[$typeInfo['type']] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,6 +188,76 @@ final class Validator
|
|||||||
return $this->table->get($table, $field, 'db');
|
return $this->table->get($table, $field, 'db');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register validators for MySQL data types.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
private function registerValidators(): void
|
||||||
|
{
|
||||||
|
$this->validators = [
|
||||||
|
'int' => [$this, 'validateInteger'],
|
||||||
|
'tinyint' => [$this, 'validateInteger'],
|
||||||
|
'smallint' => [$this, 'validateInteger'],
|
||||||
|
'mediumint' => [$this, 'validateInteger'],
|
||||||
|
'bigint' => [$this, 'validateInteger'],
|
||||||
|
'varchar' => [$this, 'validateString'],
|
||||||
|
'char' => [$this, 'validateString'],
|
||||||
|
'text' => [$this, 'validateText'],
|
||||||
|
'tinytext' => [$this, 'validateText'],
|
||||||
|
'mediumtext' => [$this, 'validateText'],
|
||||||
|
'longtext' => [$this, 'validateText'],
|
||||||
|
'decimal' => [$this, 'validateDecimal'],
|
||||||
|
'float' => [$this, 'validateFloat'],
|
||||||
|
'double' => [$this, 'validateFloat'],
|
||||||
|
'date' => [$this, 'validateDate'],
|
||||||
|
'datetime' => [$this, 'validateDate'],
|
||||||
|
'timestamp' => [$this, 'validateDate'],
|
||||||
|
'time' => [$this, 'validateDate'],
|
||||||
|
'json' => [$this, 'validateJson'],
|
||||||
|
'blob' => [$this, 'validateBlob'],
|
||||||
|
'tinyblob' => [$this, 'validateBlob'],
|
||||||
|
'mediumblob' => [$this, 'validateBlob'],
|
||||||
|
'longblob' => [$this, 'validateBlob'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register default values for MySQL data types.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
private function registerDefaults(): void
|
||||||
|
{
|
||||||
|
$this->defaults = [
|
||||||
|
'int' => 0,
|
||||||
|
'tinyint' => 0,
|
||||||
|
'smallint' => 0,
|
||||||
|
'mediumint' => 0,
|
||||||
|
'bigint' => 0,
|
||||||
|
'varchar' => '',
|
||||||
|
'char' => '',
|
||||||
|
'text' => '',
|
||||||
|
'tinytext' => '',
|
||||||
|
'mediumtext' => '',
|
||||||
|
'longtext' => '',
|
||||||
|
'decimal' => 0.0,
|
||||||
|
'float' => 0.0,
|
||||||
|
'double' => 0.0,
|
||||||
|
'date' => '0000-00-00',
|
||||||
|
'datetime' => '0000-00-00 00:00:00',
|
||||||
|
'timestamp' => '0000-00-00 00:00:00',
|
||||||
|
'time' => '00:00:00',
|
||||||
|
'json' => '{}',
|
||||||
|
'blob' => '',
|
||||||
|
'tinyblob' => '',
|
||||||
|
'mediumblob' => '',
|
||||||
|
'longblob' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------- Validation Methods -----------------
|
// ----------------- Validation Methods -----------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,14 @@
|
|||||||
*/
|
*/
|
||||||
protected array $validators = [];
|
protected array $validators = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of defauts for the respective datatypes.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
protected array $defaults = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@ -26,28 +34,10 @@
|
|||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
|
|
||||||
// Register datatype validators (mapping MySQL types to handlers)
|
// Register datatype validators (mapping MySQL types to handlers)
|
||||||
$this->validators = [
|
$this->registerValidators();
|
||||||
'int' => [$this, 'validateInteger'],
|
|
||||||
'tinyint' => [$this, 'validateInteger'],
|
// Register datatype defaults
|
||||||
'smallint' => [$this, 'validateInteger'],
|
$this->registerDefaults();
|
||||||
'mediumint' => [$this, 'validateInteger'],
|
|
||||||
'bigint' => [$this, 'validateInteger'],
|
|
||||||
'varchar' => [$this, 'validateString'],
|
|
||||||
'char' => [$this, 'validateString'],
|
|
||||||
'text' => [$this, 'validateText'],
|
|
||||||
'tinytext' => [$this, 'validateText'],
|
|
||||||
'mediumtext' => [$this, 'validateText'],
|
|
||||||
'longtext' => [$this, 'validateText'],
|
|
||||||
'decimal' => [$this, 'validateDecimal'],
|
|
||||||
'float' => [$this, 'validateFloat'],
|
|
||||||
'double' => [$this, 'validateFloat'],
|
|
||||||
'date' => [$this, 'validateDate'],
|
|
||||||
'datetime' => [$this, 'validateDate'],
|
|
||||||
'timestamp' => [$this, 'validateDate'],
|
|
||||||
'time' => [$this, 'validateDate'],
|
|
||||||
'json' => [$this, 'validateJson'],
|
|
||||||
'blob' => [$this, 'validateBlob'],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +67,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If invalid, return default, NULL (if allowed), or empty string
|
// If invalid, return default, NULL (if allowed), or empty string
|
||||||
return $this->getDefault($dbField);
|
return $this->getDefault($dbField, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,16 +100,20 @@
|
|||||||
* Handle returning the default value, null, or empty string if validation fails.
|
* Handle returning the default value, null, or empty string if validation fails.
|
||||||
*
|
*
|
||||||
* @param array $dbField The database field details.
|
* @param array $dbField The database field details.
|
||||||
|
* @param mixed $value The value to validate.
|
||||||
*
|
*
|
||||||
* @return mixed The default value, null, or empty string based on field settings.
|
* @return mixed The default value, null, or empty string based on field settings.
|
||||||
* @since 5.3.0
|
* @since 5.3.0
|
||||||
*/
|
*/
|
||||||
private function getDefault(array $dbField)
|
private function getDefault(array $dbField, $value)
|
||||||
{
|
{
|
||||||
|
// get default value from field db
|
||||||
|
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
|
||||||
|
|
||||||
// If a default value is provided, return it
|
// If a default value is provided, return it
|
||||||
if (!empty($dbField['default']))
|
if ($db_default !== null)
|
||||||
{
|
{
|
||||||
return strtoupper($dbField['default']) === 'EMPTY' ? '' : $dbField['default'];
|
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if NULL is allowed
|
// Check if NULL is allowed
|
||||||
@ -128,8 +122,9 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no default value, return an empty string
|
// Fallback to datatype default
|
||||||
return '';
|
$typeInfo = $this->parseDataType($dbField['type']);
|
||||||
|
return $this->defaults[$typeInfo['type']] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +163,76 @@
|
|||||||
return $this->table->get($table, $field, 'db');
|
return $this->table->get($table, $field, 'db');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register validators for MySQL data types.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
private function registerValidators(): void
|
||||||
|
{
|
||||||
|
$this->validators = [
|
||||||
|
'int' => [$this, 'validateInteger'],
|
||||||
|
'tinyint' => [$this, 'validateInteger'],
|
||||||
|
'smallint' => [$this, 'validateInteger'],
|
||||||
|
'mediumint' => [$this, 'validateInteger'],
|
||||||
|
'bigint' => [$this, 'validateInteger'],
|
||||||
|
'varchar' => [$this, 'validateString'],
|
||||||
|
'char' => [$this, 'validateString'],
|
||||||
|
'text' => [$this, 'validateText'],
|
||||||
|
'tinytext' => [$this, 'validateText'],
|
||||||
|
'mediumtext' => [$this, 'validateText'],
|
||||||
|
'longtext' => [$this, 'validateText'],
|
||||||
|
'decimal' => [$this, 'validateDecimal'],
|
||||||
|
'float' => [$this, 'validateFloat'],
|
||||||
|
'double' => [$this, 'validateFloat'],
|
||||||
|
'date' => [$this, 'validateDate'],
|
||||||
|
'datetime' => [$this, 'validateDate'],
|
||||||
|
'timestamp' => [$this, 'validateDate'],
|
||||||
|
'time' => [$this, 'validateDate'],
|
||||||
|
'json' => [$this, 'validateJson'],
|
||||||
|
'blob' => [$this, 'validateBlob'],
|
||||||
|
'tinyblob' => [$this, 'validateBlob'],
|
||||||
|
'mediumblob' => [$this, 'validateBlob'],
|
||||||
|
'longblob' => [$this, 'validateBlob'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register default values for MySQL data types.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
private function registerDefaults(): void
|
||||||
|
{
|
||||||
|
$this->defaults = [
|
||||||
|
'int' => 0,
|
||||||
|
'tinyint' => 0,
|
||||||
|
'smallint' => 0,
|
||||||
|
'mediumint' => 0,
|
||||||
|
'bigint' => 0,
|
||||||
|
'varchar' => '',
|
||||||
|
'char' => '',
|
||||||
|
'text' => '',
|
||||||
|
'tinytext' => '',
|
||||||
|
'mediumtext' => '',
|
||||||
|
'longtext' => '',
|
||||||
|
'decimal' => 0.0,
|
||||||
|
'float' => 0.0,
|
||||||
|
'double' => 0.0,
|
||||||
|
'date' => '0000-00-00',
|
||||||
|
'datetime' => '0000-00-00 00:00:00',
|
||||||
|
'timestamp' => '0000-00-00 00:00:00',
|
||||||
|
'time' => '00:00:00',
|
||||||
|
'json' => '{}',
|
||||||
|
'blob' => '',
|
||||||
|
'tinyblob' => '',
|
||||||
|
'mediumblob' => '',
|
||||||
|
'longblob' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------- Validation Methods -----------------
|
// ----------------- Validation Methods -----------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
"add_licensing_template": "2",
|
"add_licensing_template": "2",
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "79fd4f39-824d-4ab6-936d-959705ff24ec",
|
"guid": "79fd4f39-824d-4ab6-936d-959705ff24ec",
|
||||||
"implements": null,
|
"implements": [
|
||||||
|
"feb3affa-5102-4307-93db-04525f4c66f0"
|
||||||
|
],
|
||||||
"load_selection": null,
|
"load_selection": null,
|
||||||
"name": "Validator",
|
"name": "Validator",
|
||||||
"power_version": "1.0.0",
|
"power_version": "1.0.0",
|
||||||
|
@ -16,6 +16,9 @@ abstract Import #Orange {
|
|||||||
# Items $items
|
# Items $items
|
||||||
# ImportEngine $import
|
# ImportEngine $import
|
||||||
# string $queueTable
|
# string $queueTable
|
||||||
|
# string $queueStatusField
|
||||||
|
# int $queueWaitState
|
||||||
|
# int $queueProcessingState
|
||||||
# string $targetName
|
# string $targetName
|
||||||
# string $targetImportClass
|
# string $targetImportClass
|
||||||
# static $defaultName
|
# static $defaultName
|
||||||
|
@ -54,6 +54,30 @@ abstract class Import extends AbstractCommand
|
|||||||
*/
|
*/
|
||||||
protected string $queueTable;
|
protected string $queueTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue status field
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $queueStatusField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue awaiting status
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $queueWaitState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue processing status
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $queueProcessingState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main import target name.
|
* The main import target name.
|
||||||
*
|
*
|
||||||
@ -139,7 +163,7 @@ EOF);
|
|||||||
$io->title("Component Builder: {$this->targetName} import status");
|
$io->title("Component Builder: {$this->targetName} import status");
|
||||||
|
|
||||||
// Get all imports in the queue that are in waiting state
|
// Get all imports in the queue that are in waiting state
|
||||||
if (($queue = $this->items->table($this->queueTable)->get([1], 'import_status')) === null)
|
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
|
||||||
{
|
{
|
||||||
// Get the current date and time
|
// Get the current date and time
|
||||||
$timestamp = date('Y-m-d H:i:s');
|
$timestamp = date('Y-m-d H:i:s');
|
||||||
@ -150,6 +174,15 @@ EOF);
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take spreadsheets out of queue
|
||||||
|
$this->items->table($this->queueTable)->set(array_map(function($item) {
|
||||||
|
return [
|
||||||
|
'guid' => $item->guid,
|
||||||
|
$this->queueStatusField => $this->queueProcessingState
|
||||||
|
];
|
||||||
|
}, $queue));
|
||||||
|
|
||||||
|
// size of the queue
|
||||||
$numberSteps = count((array) $queue);
|
$numberSteps = count((array) $queue);
|
||||||
|
|
||||||
// Output initial task information
|
// Output initial task information
|
||||||
|
@ -22,6 +22,30 @@
|
|||||||
*/
|
*/
|
||||||
protected string $queueTable;
|
protected string $queueTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue status field
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $queueStatusField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue awaiting status
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $queueWaitState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue processing status
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $queueProcessingState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main import target name.
|
* The main import target name.
|
||||||
*
|
*
|
||||||
@ -107,7 +131,7 @@ EOF);
|
|||||||
$io->title("Component Builder: {$this->targetName} import status");
|
$io->title("Component Builder: {$this->targetName} import status");
|
||||||
|
|
||||||
// Get all imports in the queue that are in waiting state
|
// Get all imports in the queue that are in waiting state
|
||||||
if (($queue = $this->items->table($this->queueTable)->get([1], 'import_status')) === null)
|
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
|
||||||
{
|
{
|
||||||
// Get the current date and time
|
// Get the current date and time
|
||||||
$timestamp = date('Y-m-d H:i:s');
|
$timestamp = date('Y-m-d H:i:s');
|
||||||
@ -118,6 +142,15 @@ EOF);
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take spreadsheets out of queue
|
||||||
|
$this->items->table($this->queueTable)->set(array_map(function($item) {
|
||||||
|
return [
|
||||||
|
'guid' => $item->guid,
|
||||||
|
$this->queueStatusField => $this->queueProcessingState
|
||||||
|
];
|
||||||
|
}, $queue));
|
||||||
|
|
||||||
|
// size of the queue
|
||||||
$numberSteps = count((array) $queue);
|
$numberSteps = count((array) $queue);
|
||||||
|
|
||||||
// Output initial task information
|
// Output initial task information
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
"use": "ff8d5fdb-2d1f-4178-bd18-a43b8efd1068",
|
"use": "ff8d5fdb-2d1f-4178-bd18-a43b8efd1068",
|
||||||
"as": "ImportFactory"
|
"as": "ImportFactory"
|
||||||
},
|
},
|
||||||
"use_selection2": {
|
"use_selection1": {
|
||||||
"use": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
|
"use": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
|
||||||
"as": "ImportEngine"
|
"as": "ImportEngine"
|
||||||
},
|
},
|
||||||
"use_selection1": {
|
"use_selection2": {
|
||||||
"use": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
"use": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
},
|
},
|
||||||
|
87
src/afb5b891-7130-422a-b389-1934b0e4fc48/README.md
Normal file
87
src/afb5b891-7130-422a-b389-1934b0e4fc48/README.md
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Row (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Row << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
- array $values
|
||||||
|
- int $index
|
||||||
|
- bool $isSet
|
||||||
|
+ set(int $index, array $values) : void
|
||||||
|
+ clear() : self
|
||||||
|
+ getIndex() : int
|
||||||
|
+ getValue(string $key) : mixed
|
||||||
|
+ unsetValue(string $key) : void
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Row::set
|
||||||
|
Set the row details
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Row::clear
|
||||||
|
Clear the row details
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Row::getIndex
|
||||||
|
Get Index
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: int
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Row::getValue
|
||||||
|
Get Value
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: mixed
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Row::unsetValue
|
||||||
|
Unset Value
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
131
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php
Normal file
131
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?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\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportRowInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Row Class
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
final class Row implements ImportRowInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The row array of values.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The row index.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private int $index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flag to track if values and index are set.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private bool $isSet = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void
|
||||||
|
{
|
||||||
|
$this->index = $index;
|
||||||
|
$this->values = $values;
|
||||||
|
$this->isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function clear(): self
|
||||||
|
{
|
||||||
|
$this->index = 0;
|
||||||
|
$this->values = [];
|
||||||
|
$this->isSet = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function getIndex(): int
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Index must not be null or empty. Use the set method to first set the index.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function getValue(string $key)
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->values[$key] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($this->values[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
105
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.power
Normal file
105
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.power
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* The row array of values.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The row index.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private int $index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A flag to track if values and index are set.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private bool $isSet = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void
|
||||||
|
{
|
||||||
|
$this->index = $index;
|
||||||
|
$this->values = $values;
|
||||||
|
$this->isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function clear(): self
|
||||||
|
{
|
||||||
|
$this->index = 0;
|
||||||
|
$this->values = [];
|
||||||
|
$this->isSet = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function getIndex(): int
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Index must not be null or empty. Use the set method to first set the index.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function getValue(string $key)
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->values[$key] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void
|
||||||
|
{
|
||||||
|
if (!$this->isSet)
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($this->values[$key]);
|
||||||
|
}
|
21
src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json
Normal file
21
src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "afb5b891-7130-422a-b389-1934b0e4fc48",
|
||||||
|
"implements": [
|
||||||
|
"3d3ec064-9867-41e6-a48a-964c15d753aa"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Row",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Row",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Row",
|
||||||
|
"description": "Import Row Class\r\n\r\n@since 4.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
namespace VDM\Joomla\Componentbuilder;
|
namespace VDM\Joomla\Componentbuilder;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\Tableinterface;
|
use VDM\Joomla\Interfaces\TableInterface;
|
||||||
use VDM\Joomla\Abstraction\BaseTable;
|
use VDM\Joomla\Abstraction\BaseTable;
|
||||||
|
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ use VDM\Joomla\Abstraction\BaseTable;
|
|||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
final class Table extends BaseTable implements Tableinterface
|
final class Table extends BaseTable implements TableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* All areas/views/tables with their field details
|
* All areas/views/tables with their field details
|
||||||
|
104
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/README.md
Normal file
104
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/README.md
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Status (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Status << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Item $item
|
||||||
|
# string $table
|
||||||
|
# string $fieldName
|
||||||
|
+ __construct(Item $item, ?string $table = null, ...)
|
||||||
|
+ set(int $status, string $guid) : void
|
||||||
|
+ table(string $table) : self
|
||||||
|
+ field(string $fieldName) : self
|
||||||
|
+ getTable() : string
|
||||||
|
+ getField() : string
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Status::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Item $item
|
||||||
|
?string $table = null
|
||||||
|
?string $field = null
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Status::set
|
||||||
|
Updates the status in the database.
|
||||||
|
This method updates the import status in the database based on the result of the import process.
|
||||||
|
Status codes:
|
||||||
|
- 2: Being Processed.
|
||||||
|
- 3: Import completed successfully.
|
||||||
|
- 4: Import completed with errors.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Status::table
|
||||||
|
Set the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Status::field
|
||||||
|
Set the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Status::getTable
|
||||||
|
Get the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Status::getField
|
||||||
|
Get the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
149
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php
Normal file
149
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<?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\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportStatusInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Status Class
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
final class Status implements ImportStatusInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status Field Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $fieldName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
* @param string|null $table The table name
|
||||||
|
* @param string|null $field The field name.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Item $item, ?string $table = null, ?string $field = null)
|
||||||
|
{
|
||||||
|
$this->item = $item;
|
||||||
|
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($field !== null)
|
||||||
|
{
|
||||||
|
$this->field = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void
|
||||||
|
{
|
||||||
|
$this->item->table($this->getTable())->set((object) [
|
||||||
|
'guid' => $guid,
|
||||||
|
$this->getField() => $status
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self
|
||||||
|
{
|
||||||
|
$this->fieldName = $fieldName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string
|
||||||
|
{
|
||||||
|
return $this->fieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
122
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.power
Normal file
122
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.power
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status Field Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $fieldName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
* @param string|null $table The table name
|
||||||
|
* @param string|null $field The field name.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Item $item, ?string $table = null, ?string $field = null)
|
||||||
|
{
|
||||||
|
$this->item = $item;
|
||||||
|
|
||||||
|
if ($table !== null)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($field !== null)
|
||||||
|
{
|
||||||
|
$this->field = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void
|
||||||
|
{
|
||||||
|
$this->item->table($this->getTable())->set((object) [
|
||||||
|
'guid' => $guid,
|
||||||
|
$this->getField() => $status
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self
|
||||||
|
{
|
||||||
|
$this->fieldName = $fieldName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string
|
||||||
|
{
|
||||||
|
return $this->fieldName;
|
||||||
|
}
|
26
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json
Normal file
26
src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "d2a859ac-3f2a-4f69-a77f-f118b2e0a459",
|
||||||
|
"implements": [
|
||||||
|
"0e44d149-4863-47ec-8f0f-6a821ab3e77f"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Status",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Status",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
|
"as": "Item"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Status",
|
||||||
|
"description": "Import Status Class\r\n\r\n@since 5.0.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -12,7 +12,7 @@
|
|||||||
namespace VDM\Joomla\Abstraction;
|
namespace VDM\Joomla\Abstraction;
|
||||||
|
|
||||||
|
|
||||||
use VDM\Joomla\Interfaces\Tableinterface;
|
use VDM\Joomla\Interfaces\TableInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,7 +20,7 @@ use VDM\Joomla\Interfaces\Tableinterface;
|
|||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
abstract class BaseTable implements Tableinterface
|
abstract class BaseTable implements TableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* All areas/views/tables with their field details
|
* All areas/views/tables with their field details
|
||||||
|
134
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/README.md
Normal file
134
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/README.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Message (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Message << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Update $update
|
||||||
|
# Insert $insert
|
||||||
|
- array $success
|
||||||
|
- array $error
|
||||||
|
- ?string $guid
|
||||||
|
- ?string $entity
|
||||||
|
- ?string $table
|
||||||
|
+ __construct(Update $update, Insert $insert)
|
||||||
|
+ load(string $guid, string $entity, ...) : self
|
||||||
|
+ get() : object
|
||||||
|
+ reset() : void
|
||||||
|
+ archive() : self
|
||||||
|
+ set() : self
|
||||||
|
+ addSuccess(string $message) : self
|
||||||
|
+ addInfo(string $message) : self
|
||||||
|
+ addError(string $message) : self
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Message::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Message::load
|
||||||
|
Load an entity that these message belong to
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $guid
|
||||||
|
string $entity
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Message::get
|
||||||
|
Get the messages of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Message::reset
|
||||||
|
Reset the messages of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Message::archive
|
||||||
|
Archive the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Message::set
|
||||||
|
Set the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Message::addSuccess
|
||||||
|
Adds a success message to the log.
|
||||||
|
This method records a success message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the success rate.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Message::addInfo
|
||||||
|
Adds a info message to the log.
|
||||||
|
This method records a info message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the info rate.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Message::addError
|
||||||
|
Adds an error message to the log.
|
||||||
|
This method records an error message when the import process encounters issues.
|
||||||
|
The message includes details about the failures, such as the number of failed rows
|
||||||
|
and the corresponding error rate.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
297
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php
Normal file
297
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
<?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\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Interfaces\Data\UpdateInterface as Update;
|
||||||
|
use VDM\Joomla\Interfaces\Data\InsertInterface as Insert;
|
||||||
|
use VDM\Joomla\Utilities\GuidHelper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportMessageInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Messages Class
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
final class Message implements ImportMessageInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Update Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Insert Class.
|
||||||
|
*
|
||||||
|
* @var Insert
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Insert $insert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message bus.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $success = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error message bus.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $error = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity GUID value.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $guid = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity type value.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $entity = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity table value.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $table = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Update $update The Update Class.
|
||||||
|
* @param Insert $insert The Insert Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Update $update, Insert $insert)
|
||||||
|
{
|
||||||
|
$this->update = $update;
|
||||||
|
$this->insert = $insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self
|
||||||
|
{
|
||||||
|
if (empty($guid) || empty($entity) || empty($table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// set entity details
|
||||||
|
$this->guid = $guid;
|
||||||
|
$this->entity = $entity;
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object
|
||||||
|
{
|
||||||
|
return (object) [
|
||||||
|
'message_success' => $this->success ?? null,
|
||||||
|
'message_info' => $this->info ?? null,
|
||||||
|
'message_error' => $this->error ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void
|
||||||
|
{
|
||||||
|
// clear the message bus
|
||||||
|
$this->success = [];
|
||||||
|
$this->info = [];
|
||||||
|
$this->error = [];
|
||||||
|
|
||||||
|
$this->guid = null;
|
||||||
|
$this->entity = null;
|
||||||
|
$this->table = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self
|
||||||
|
{
|
||||||
|
if (empty($this->guid) || empty($this->entity) || empty($this->table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// trash all messages from the past
|
||||||
|
$this->update->table($this->table)->rows([['entity' => $this->guid, 'published' => -2]], 'entity');
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self
|
||||||
|
{
|
||||||
|
if (empty($this->guid) || empty($this->entity) || empty($this->table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// start message bucket
|
||||||
|
$messages = [];
|
||||||
|
|
||||||
|
// set the success messages
|
||||||
|
if (!empty($this->success))
|
||||||
|
{
|
||||||
|
foreach ($this->success as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the info messages
|
||||||
|
if (!empty($this->info))
|
||||||
|
{
|
||||||
|
foreach ($this->info as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 2
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the error messages
|
||||||
|
if (!empty($this->error))
|
||||||
|
{
|
||||||
|
foreach ($this->error as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 3
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->insert->table($this->table)->rows($messages);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self
|
||||||
|
{
|
||||||
|
$this->success[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self
|
||||||
|
{
|
||||||
|
$this->info[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self
|
||||||
|
{
|
||||||
|
$this->error[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
268
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.power
Normal file
268
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.power
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
/**
|
||||||
|
* The Update Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Insert Class.
|
||||||
|
*
|
||||||
|
* @var Insert
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Insert $insert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The success message bus.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $success = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error message bus.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private array $error = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity GUID value.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $guid = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity type value.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $entity = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entity table value.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private ?string $table = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Update $update The Update Class.
|
||||||
|
* @param Insert $insert The Insert Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Update $update, Insert $insert)
|
||||||
|
{
|
||||||
|
$this->update = $update;
|
||||||
|
$this->insert = $insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self
|
||||||
|
{
|
||||||
|
if (empty($guid) || empty($entity) || empty($table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// set entity details
|
||||||
|
$this->guid = $guid;
|
||||||
|
$this->entity = $entity;
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object
|
||||||
|
{
|
||||||
|
return (object) [
|
||||||
|
'message_success' => $this->success ?? null,
|
||||||
|
'message_info' => $this->info ?? null,
|
||||||
|
'message_error' => $this->error ?? null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void
|
||||||
|
{
|
||||||
|
// clear the message bus
|
||||||
|
$this->success = [];
|
||||||
|
$this->info = [];
|
||||||
|
$this->error = [];
|
||||||
|
|
||||||
|
$this->guid = null;
|
||||||
|
$this->entity = null;
|
||||||
|
$this->table = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self
|
||||||
|
{
|
||||||
|
if (empty($this->guid) || empty($this->entity) || empty($this->table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// trash all messages from the past
|
||||||
|
$this->update->table($this->table)->rows([['entity' => $this->guid, 'published' => -2]], 'entity');
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self
|
||||||
|
{
|
||||||
|
if (empty($this->guid) || empty($this->entity) || empty($this->table))
|
||||||
|
{
|
||||||
|
throw new \InvalidArgumentException('GUID, entity, and table must not be null or empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// start message bucket
|
||||||
|
$messages = [];
|
||||||
|
|
||||||
|
// set the success messages
|
||||||
|
if (!empty($this->success))
|
||||||
|
{
|
||||||
|
foreach ($this->success as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the info messages
|
||||||
|
if (!empty($this->info))
|
||||||
|
{
|
||||||
|
foreach ($this->info as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 2
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the error messages
|
||||||
|
if (!empty($this->error))
|
||||||
|
{
|
||||||
|
foreach ($this->error as $message)
|
||||||
|
{
|
||||||
|
$messages[] = [
|
||||||
|
'guid' => GuidHelper::get(),
|
||||||
|
'entity' => $this->guid,
|
||||||
|
'entity_type' => $this->entity,
|
||||||
|
'message' => $message,
|
||||||
|
'message_status' => 3
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->insert->table($this->table)->rows($messages);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self
|
||||||
|
{
|
||||||
|
$this->success[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self
|
||||||
|
{
|
||||||
|
$this->info[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self
|
||||||
|
{
|
||||||
|
$this->error[] = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
34
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json
Normal file
34
src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0",
|
||||||
|
"implements": [
|
||||||
|
"23ad6e72-1b82-40fb-836c-50da690bb174"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Message",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Message",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "68a41264-64c0-441a-a3d8-8a5e557b1883",
|
||||||
|
"as": "Update"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13",
|
||||||
|
"as": "Insert"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Message",
|
||||||
|
"description": "Import Messages Class\r\n\r\n@since 5.0.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -14,7 +14,7 @@ namespace VDM\Joomla\Abstraction;
|
|||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Version;
|
use Joomla\CMS\Version;
|
||||||
use VDM\Joomla\Interfaces\Tableinterface as Table;
|
use VDM\Joomla\Interfaces\TableInterface as Table;
|
||||||
use VDM\Joomla\Interfaces\SchemaInterface;
|
use VDM\Joomla\Interfaces\SchemaInterface;
|
||||||
|
|
||||||
|
|
||||||
|
59
src/feb3affa-5102-4307-93db-04525f4c66f0/README.md
Normal file
59
src/feb3affa-5102-4307-93db-04525f4c66f0/README.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface TableValidatorInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface TableValidatorInterface #Lavender {
|
||||||
|
+ getValid(mixed $value, string $field, ...) : mixed
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of TableValidatorInterface::getValid
|
||||||
|
Returns the valid value based on datatype definition.
|
||||||
|
If the value is valid, return it. If not, return the default value,
|
||||||
|
NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||||
|
|
||||||
|
since: 5.3.0
|
||||||
|
return: mixed
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
mixed $value
|
||||||
|
string $field
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---feb3affa_5102_4307_93db_04525f4c66f0---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
34
src/feb3affa-5102-4307-93db-04525f4c66f0/code.php
Normal file
34
src/feb3affa-5102-4307-93db-04525f4c66f0/code.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?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\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The VDM Core Table Validator Interface
|
||||||
|
*/
|
||||||
|
interface TableValidatorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the valid value based on datatype definition.
|
||||||
|
* If the value is valid, return it. If not, return the default value,
|
||||||
|
* NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to validate.
|
||||||
|
* @param string $field The field name.
|
||||||
|
* @param string $table The table name.
|
||||||
|
*
|
||||||
|
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
public function getValid($value, string $field, string $table);
|
||||||
|
}
|
||||||
|
|
13
src/feb3affa-5102-4307-93db-04525f4c66f0/code.power
Normal file
13
src/feb3affa-5102-4307-93db-04525f4c66f0/code.power
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Returns the valid value based on datatype definition.
|
||||||
|
* If the value is valid, return it. If not, return the default value,
|
||||||
|
* NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||||
|
*
|
||||||
|
* @param mixed $value The value to validate.
|
||||||
|
* @param string $field The field name.
|
||||||
|
* @param string $table The table name.
|
||||||
|
*
|
||||||
|
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
|
||||||
|
* @since 5.3.0
|
||||||
|
*/
|
||||||
|
public function getValid($value, string $field, string $table);
|
19
src/feb3affa-5102-4307-93db-04525f4c66f0/settings.json
Normal file
19
src/feb3affa-5102-4307-93db-04525f4c66f0/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"extends": "",
|
||||||
|
"guid": "feb3affa-5102-4307-93db-04525f4c66f0",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "TableValidatorInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.Interfaces.TableValidatorInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.TableValidatorInterface",
|
||||||
|
"description": "The VDM Core Table Validator Interface",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -16,6 +16,7 @@ use VDM\Joomla\Service\Table;
|
|||||||
use VDM\Joomla\Service\Database;
|
use VDM\Joomla\Service\Database;
|
||||||
use VDM\Joomla\Service\Model;
|
use VDM\Joomla\Service\Model;
|
||||||
use VDM\Joomla\Service\Data;
|
use VDM\Joomla\Service\Data;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Service\Import;
|
||||||
use VDM\Joomla\Componentbuilder\File\Service\File;
|
use VDM\Joomla\Componentbuilder\File\Service\File;
|
||||||
use VDM\Joomla\Componentbuilder\Service\Spreadsheet;
|
use VDM\Joomla\Componentbuilder\Service\Spreadsheet;
|
||||||
use VDM\Joomla\Interfaces\FactoryInterface;
|
use VDM\Joomla\Interfaces\FactoryInterface;
|
||||||
@ -50,6 +51,7 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
|
|||||||
->registerServiceProvider(new Database())
|
->registerServiceProvider(new Database())
|
||||||
->registerServiceProvider(new Model())
|
->registerServiceProvider(new Model())
|
||||||
->registerServiceProvider(new Data())
|
->registerServiceProvider(new Data())
|
||||||
|
->registerServiceProvider(new Import())
|
||||||
->registerServiceProvider(new File())
|
->registerServiceProvider(new File())
|
||||||
->registerServiceProvider(new Spreadsheet());
|
->registerServiceProvider(new Spreadsheet());
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
->registerServiceProvider(new Database())
|
->registerServiceProvider(new Database())
|
||||||
->registerServiceProvider(new Model())
|
->registerServiceProvider(new Model())
|
||||||
->registerServiceProvider(new Data())
|
->registerServiceProvider(new Data())
|
||||||
|
->registerServiceProvider(new Import())
|
||||||
->registerServiceProvider(new File())
|
->registerServiceProvider(new File())
|
||||||
->registerServiceProvider(new Spreadsheet());
|
->registerServiceProvider(new Spreadsheet());
|
||||||
}
|
}
|
@ -28,6 +28,10 @@
|
|||||||
"use": "a5daf189-3345-4b13-8716-c51f686f545b",
|
"use": "a5daf189-3345-4b13-8716-c51f686f545b",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
},
|
},
|
||||||
|
"use_selection6": {
|
||||||
|
"use": "21754a8b-2323-4a77-8459-378a74c1ec97",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
"use_selection4": {
|
"use_selection4": {
|
||||||
"use": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
"use": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
|
@ -54,6 +54,17 @@
|
|||||||
"spk": "Super---0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a---Power",
|
"spk": "Super---0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a---Power",
|
||||||
"guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a"
|
"guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a"
|
||||||
},
|
},
|
||||||
|
"0e44d149-4863-47ec-8f0f-6a821ab3e77f": {
|
||||||
|
"name": "ImportStatusInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/0e44d149-4863-47ec-8f0f-6a821ab3e77f\/code.php",
|
||||||
|
"power": "src\/0e44d149-4863-47ec-8f0f-6a821ab3e77f\/code.power",
|
||||||
|
"settings": "src\/0e44d149-4863-47ec-8f0f-6a821ab3e77f\/settings.json",
|
||||||
|
"path": "src\/0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||||
|
"spk": "Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power",
|
||||||
|
"guid": "0e44d149-4863-47ec-8f0f-6a821ab3e77f"
|
||||||
|
},
|
||||||
"0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9": {
|
"0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9": {
|
||||||
"name": "ImportCliInterface",
|
"name": "ImportCliInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
@ -208,6 +219,17 @@
|
|||||||
"spk": "Super---217416f6_24cf_41c0_b18e_11086111d447---Power",
|
"spk": "Super---217416f6_24cf_41c0_b18e_11086111d447---Power",
|
||||||
"guid": "217416f6-24cf-41c0-b18e-11086111d447"
|
"guid": "217416f6-24cf-41c0-b18e-11086111d447"
|
||||||
},
|
},
|
||||||
|
"21754a8b-2323-4a77-8459-378a74c1ec97": {
|
||||||
|
"name": "Import",
|
||||||
|
"type": "class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Import\\Service",
|
||||||
|
"code": "src\/21754a8b-2323-4a77-8459-378a74c1ec97\/code.php",
|
||||||
|
"power": "src\/21754a8b-2323-4a77-8459-378a74c1ec97\/code.power",
|
||||||
|
"settings": "src\/21754a8b-2323-4a77-8459-378a74c1ec97\/settings.json",
|
||||||
|
"path": "src\/21754a8b-2323-4a77-8459-378a74c1ec97",
|
||||||
|
"spk": "Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power",
|
||||||
|
"guid": "21754a8b-2323-4a77-8459-378a74c1ec97"
|
||||||
|
},
|
||||||
"21bca8a4-5b28-41c4-843e-8097f0ba7cca": {
|
"21bca8a4-5b28-41c4-843e-8097f0ba7cca": {
|
||||||
"name": "Items",
|
"name": "Items",
|
||||||
"type": "final class",
|
"type": "final class",
|
||||||
@ -219,6 +241,17 @@
|
|||||||
"spk": "Super---21bca8a4_5b28_41c4_843e_8097f0ba7cca---Power",
|
"spk": "Super---21bca8a4_5b28_41c4_843e_8097f0ba7cca---Power",
|
||||||
"guid": "21bca8a4-5b28-41c4-843e-8097f0ba7cca"
|
"guid": "21bca8a4-5b28-41c4-843e-8097f0ba7cca"
|
||||||
},
|
},
|
||||||
|
"23ad6e72-1b82-40fb-836c-50da690bb174": {
|
||||||
|
"name": "ImportMessageInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/23ad6e72-1b82-40fb-836c-50da690bb174\/code.php",
|
||||||
|
"power": "src\/23ad6e72-1b82-40fb-836c-50da690bb174\/code.power",
|
||||||
|
"settings": "src\/23ad6e72-1b82-40fb-836c-50da690bb174\/settings.json",
|
||||||
|
"path": "src\/23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||||
|
"spk": "Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power",
|
||||||
|
"guid": "23ad6e72-1b82-40fb-836c-50da690bb174"
|
||||||
|
},
|
||||||
"2ad31f74-f579-499d-b98b-c4f54fd615dd": {
|
"2ad31f74-f579-499d-b98b-c4f54fd615dd": {
|
||||||
"name": "LoadInterface",
|
"name": "LoadInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
@ -231,7 +264,7 @@
|
|||||||
"guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd"
|
"guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd"
|
||||||
},
|
},
|
||||||
"2da6d6c4-eb29-4d69-8bc2-36d96e916adf": {
|
"2da6d6c4-eb29-4d69-8bc2-36d96e916adf": {
|
||||||
"name": "Tableinterface",
|
"name": "TableInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
"namespace": "VDM\\Joomla\\Interfaces",
|
"namespace": "VDM\\Joomla\\Interfaces",
|
||||||
"code": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf\/code.php",
|
"code": "src\/2da6d6c4-eb29-4d69-8bc2-36d96e916adf\/code.php",
|
||||||
@ -296,6 +329,17 @@
|
|||||||
"spk": "Super---3cf76fbf_fd95_4a33_878e_7aff6d36b7f6---Power",
|
"spk": "Super---3cf76fbf_fd95_4a33_878e_7aff6d36b7f6---Power",
|
||||||
"guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6"
|
"guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6"
|
||||||
},
|
},
|
||||||
|
"3d3ec064-9867-41e6-a48a-964c15d753aa": {
|
||||||
|
"name": "ImportRowInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/3d3ec064-9867-41e6-a48a-964c15d753aa\/code.php",
|
||||||
|
"power": "src\/3d3ec064-9867-41e6-a48a-964c15d753aa\/code.power",
|
||||||
|
"settings": "src\/3d3ec064-9867-41e6-a48a-964c15d753aa\/settings.json",
|
||||||
|
"path": "src\/3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||||
|
"spk": "Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power",
|
||||||
|
"guid": "3d3ec064-9867-41e6-a48a-964c15d753aa"
|
||||||
|
},
|
||||||
"3fc72954-a303-4cac-b53c-554be38b85e7": {
|
"3fc72954-a303-4cac-b53c-554be38b85e7": {
|
||||||
"name": "Delete",
|
"name": "Delete",
|
||||||
"type": "class",
|
"type": "class",
|
||||||
@ -439,6 +483,17 @@
|
|||||||
"spk": "Super---52a1d14f_304a_431c_8fa4_411179942db5---Power",
|
"spk": "Super---52a1d14f_304a_431c_8fa4_411179942db5---Power",
|
||||||
"guid": "52a1d14f-304a-431c-8fa4-411179942db5"
|
"guid": "52a1d14f-304a-431c-8fa4-411179942db5"
|
||||||
},
|
},
|
||||||
|
"53f55e5b-63cb-49e7-b1e6-33e7a9f97856": {
|
||||||
|
"name": "ImportItemInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
|
||||||
|
"code": "src\/53f55e5b-63cb-49e7-b1e6-33e7a9f97856\/code.php",
|
||||||
|
"power": "src\/53f55e5b-63cb-49e7-b1e6-33e7a9f97856\/code.power",
|
||||||
|
"settings": "src\/53f55e5b-63cb-49e7-b1e6-33e7a9f97856\/settings.json",
|
||||||
|
"path": "src\/53f55e5b-63cb-49e7-b1e6-33e7a9f97856",
|
||||||
|
"spk": "Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power",
|
||||||
|
"guid": "53f55e5b-63cb-49e7-b1e6-33e7a9f97856"
|
||||||
|
},
|
||||||
"576685fd-263c-46bb-9fdc-1f5eb234cbb6": {
|
"576685fd-263c-46bb-9fdc-1f5eb234cbb6": {
|
||||||
"name": "GuidInterface",
|
"name": "GuidInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
@ -560,6 +615,17 @@
|
|||||||
"spk": "Super---67a5e0ca_0ff0_4979_9b41_da0b09988016---Power",
|
"spk": "Super---67a5e0ca_0ff0_4979_9b41_da0b09988016---Power",
|
||||||
"guid": "67a5e0ca-0ff0-4979-9b41-da0b09988016"
|
"guid": "67a5e0ca-0ff0-4979-9b41-da0b09988016"
|
||||||
},
|
},
|
||||||
|
"68a0f9af-265a-4db1-bae9-a4e4531f94d7": {
|
||||||
|
"name": "Item",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Import",
|
||||||
|
"code": "src\/68a0f9af-265a-4db1-bae9-a4e4531f94d7\/code.php",
|
||||||
|
"power": "src\/68a0f9af-265a-4db1-bae9-a4e4531f94d7\/code.power",
|
||||||
|
"settings": "src\/68a0f9af-265a-4db1-bae9-a4e4531f94d7\/settings.json",
|
||||||
|
"path": "src\/68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||||
|
"spk": "Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power",
|
||||||
|
"guid": "68a0f9af-265a-4db1-bae9-a4e4531f94d7"
|
||||||
|
},
|
||||||
"68a41264-64c0-441a-a3d8-8a5e557b1883": {
|
"68a41264-64c0-441a-a3d8-8a5e557b1883": {
|
||||||
"name": "UpdateInterface",
|
"name": "UpdateInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
@ -934,6 +1000,17 @@
|
|||||||
"spk": "Super---af0eedbe_603b_4671_8e5a_28165d88254b---Power",
|
"spk": "Super---af0eedbe_603b_4671_8e5a_28165d88254b---Power",
|
||||||
"guid": "af0eedbe-603b-4671-8e5a-28165d88254b"
|
"guid": "af0eedbe-603b-4671-8e5a-28165d88254b"
|
||||||
},
|
},
|
||||||
|
"afb5b891-7130-422a-b389-1934b0e4fc48": {
|
||||||
|
"name": "Row",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Import",
|
||||||
|
"code": "src\/afb5b891-7130-422a-b389-1934b0e4fc48\/code.php",
|
||||||
|
"power": "src\/afb5b891-7130-422a-b389-1934b0e4fc48\/code.power",
|
||||||
|
"settings": "src\/afb5b891-7130-422a-b389-1934b0e4fc48\/settings.json",
|
||||||
|
"path": "src\/afb5b891-7130-422a-b389-1934b0e4fc48",
|
||||||
|
"spk": "Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power",
|
||||||
|
"guid": "afb5b891-7130-422a-b389-1934b0e4fc48"
|
||||||
|
},
|
||||||
"b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce": {
|
"b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce": {
|
||||||
"name": "Schema",
|
"name": "Schema",
|
||||||
"type": "final class",
|
"type": "final class",
|
||||||
@ -1110,6 +1187,17 @@
|
|||||||
"spk": "Super---d1de5d5b_bf29_4031_8094_76c4f6c75900---Power",
|
"spk": "Super---d1de5d5b_bf29_4031_8094_76c4f6c75900---Power",
|
||||||
"guid": "d1de5d5b-bf29-4031-8094-76c4f6c75900"
|
"guid": "d1de5d5b-bf29-4031-8094-76c4f6c75900"
|
||||||
},
|
},
|
||||||
|
"d2a859ac-3f2a-4f69-a77f-f118b2e0a459": {
|
||||||
|
"name": "Status",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Import",
|
||||||
|
"code": "src\/d2a859ac-3f2a-4f69-a77f-f118b2e0a459\/code.php",
|
||||||
|
"power": "src\/d2a859ac-3f2a-4f69-a77f-f118b2e0a459\/code.power",
|
||||||
|
"settings": "src\/d2a859ac-3f2a-4f69-a77f-f118b2e0a459\/settings.json",
|
||||||
|
"path": "src\/d2a859ac-3f2a-4f69-a77f-f118b2e0a459",
|
||||||
|
"spk": "Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power",
|
||||||
|
"guid": "d2a859ac-3f2a-4f69-a77f-f118b2e0a459"
|
||||||
|
},
|
||||||
"d46c4667-378b-49e8-9782-ffb28d92415a": {
|
"d46c4667-378b-49e8-9782-ffb28d92415a": {
|
||||||
"name": "Display",
|
"name": "Display",
|
||||||
"type": "final class",
|
"type": "final class",
|
||||||
@ -1220,6 +1308,17 @@
|
|||||||
"spk": "Super---eb7d69c2_4ee9_4bd0_aacc_ab51a12be895---Power",
|
"spk": "Super---eb7d69c2_4ee9_4bd0_aacc_ab51a12be895---Power",
|
||||||
"guid": "eb7d69c2-4ee9-4bd0-aacc-ab51a12be895"
|
"guid": "eb7d69c2-4ee9-4bd0-aacc-ab51a12be895"
|
||||||
},
|
},
|
||||||
|
"eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0": {
|
||||||
|
"name": "Message",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\Import",
|
||||||
|
"code": "src\/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0\/code.php",
|
||||||
|
"power": "src\/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0\/code.power",
|
||||||
|
"settings": "src\/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0\/settings.json",
|
||||||
|
"path": "src\/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0",
|
||||||
|
"spk": "Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power",
|
||||||
|
"guid": "eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0"
|
||||||
|
},
|
||||||
"f11dc790-713e-4706-9a85-a318ed3ad56e": {
|
"f11dc790-713e-4706-9a85-a318ed3ad56e": {
|
||||||
"name": "MimeHelper",
|
"name": "MimeHelper",
|
||||||
"type": "abstract class",
|
"type": "abstract class",
|
||||||
@ -1253,6 +1352,17 @@
|
|||||||
"spk": "Super---fd3f322a_082d_4579_93ad_3352c5adfc71---Power",
|
"spk": "Super---fd3f322a_082d_4579_93ad_3352c5adfc71---Power",
|
||||||
"guid": "fd3f322a-082d-4579-93ad-3352c5adfc71"
|
"guid": "fd3f322a-082d-4579-93ad-3352c5adfc71"
|
||||||
},
|
},
|
||||||
|
"feb3affa-5102-4307-93db-04525f4c66f0": {
|
||||||
|
"name": "TableValidatorInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"namespace": "VDM\\Joomla\\Interfaces",
|
||||||
|
"code": "src\/feb3affa-5102-4307-93db-04525f4c66f0\/code.php",
|
||||||
|
"power": "src\/feb3affa-5102-4307-93db-04525f4c66f0\/code.power",
|
||||||
|
"settings": "src\/feb3affa-5102-4307-93db-04525f4c66f0\/settings.json",
|
||||||
|
"path": "src\/feb3affa-5102-4307-93db-04525f4c66f0",
|
||||||
|
"spk": "Super---feb3affa_5102_4307_93db_04525f4c66f0---Power",
|
||||||
|
"guid": "feb3affa-5102-4307-93db-04525f4c66f0"
|
||||||
|
},
|
||||||
"ff7d0111-8f79-42aa-ac14-b53ba2c49369": {
|
"ff7d0111-8f79-42aa-ac14-b53ba2c49369": {
|
||||||
"name": "IsString",
|
"name": "IsString",
|
||||||
"type": "trait",
|
"type": "trait",
|
||||||
|
Loading…
Reference in New Issue
Block a user