Release of v4.0.1-alpha6
Add new subform classes. Fix registry class methods return type. Update all list and custom fields to use the new layouts.
This commit is contained in:
@@ -72,7 +72,7 @@ interface ItemsInterface
|
||||
* @return bool
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function delete(string $values, string $key = 'guid'): bool;
|
||||
public function delete(array $values, string $key = 'guid'): bool;
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
|
@@ -45,6 +45,22 @@ interface LoadInterface
|
||||
*/
|
||||
public function value(array $keys, string $field);
|
||||
|
||||
/**
|
||||
* Get a value from multiple rows from a given table
|
||||
* Example: $this->values(
|
||||
* [
|
||||
* 'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
||||
* ], 'value_key'
|
||||
* );
|
||||
*
|
||||
* @param array $keys The item keys
|
||||
* @param string $field The field key
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function values(array $keys, string $field): ?array;
|
||||
|
||||
/**
|
||||
* Get values from a given table
|
||||
* Example: $this->item(
|
||||
|
@@ -0,0 +1,77 @@
|
||||
<?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\Data;
|
||||
|
||||
|
||||
/**
|
||||
* Data Multi Subform Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface MultiSubformInterface
|
||||
{
|
||||
/**
|
||||
* Get a subform items
|
||||
*
|
||||
* @param array $getMap The the map to get the subfrom data
|
||||
*
|
||||
* Example:
|
||||
* $getMap = [
|
||||
* '_core' => [
|
||||
* 'table' =>'data',
|
||||
* 'linkValue' => $item->guid ?? '',
|
||||
* 'linkKey' => 'look',
|
||||
* 'field' => 'data',
|
||||
* 'get' => ['guid','email','image','mobile_phone','website','dateofbirth']
|
||||
* ],
|
||||
* 'countries' => [
|
||||
* 'table' =>'data_country',
|
||||
* 'linkValue' => 'data:guid', // coretable:fieldname
|
||||
* 'linkKey' => 'data',
|
||||
* 'get' => ['guid','country','currency']
|
||||
* ]
|
||||
* ];
|
||||
*
|
||||
* @return array|null The subform
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function get(array $getMap): ?array;
|
||||
|
||||
/**
|
||||
* Set a subform items
|
||||
*
|
||||
* @param array $items The list of items from the subform to set
|
||||
* @param array $setMap The the map to set the subfrom data
|
||||
*
|
||||
* Example:
|
||||
* $items,
|
||||
* $setMap = [
|
||||
* '_core' => [
|
||||
* 'table' =>'data',
|
||||
* 'indexKey' => 'guid',
|
||||
* 'linkKey' => 'look',
|
||||
* 'linkValue' => $data['guid'] ?? ''
|
||||
* ],
|
||||
* 'countries' => [
|
||||
* 'table' =>'data_country',
|
||||
* 'indexKey' => 'guid',
|
||||
* 'linkKey' => 'data',
|
||||
* 'linkValue' => 'data:guid' // coretable:fieldname
|
||||
* ]
|
||||
* ];
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function set(array $items, array $setMap): bool;
|
||||
}
|
||||
|
@@ -0,0 +1,66 @@
|
||||
<?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\Data;
|
||||
|
||||
|
||||
/**
|
||||
* Data Subform Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface SubformInterface
|
||||
{
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Get a subform items
|
||||
*
|
||||
* @param string $linkValue The value of the link key in child table.
|
||||
* @param string $linkKey The link key on which the items where linked in the child table.
|
||||
* @param string $field The parent field name of the subform in the parent view.
|
||||
* @param array $set The array SET of the keys of each row in the subform.
|
||||
*
|
||||
* @return array|null The subform
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function get(string $linkValue, string $linkKey, string $field, array $set): ?array;
|
||||
|
||||
/**
|
||||
* Set a subform items
|
||||
*
|
||||
* @param array $items The list of items from the subform to set
|
||||
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete.
|
||||
* @param string $linkKey The link key on which the items where linked in the child table.
|
||||
* @param string $linkValue The value of the link key in child table.
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function set(array $items, string $indexKey, string $linkKey, string $linkValue): bool;
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getTable(): string;
|
||||
}
|
||||
|
@@ -16,7 +16,9 @@ use Joomla\DI\Container;
|
||||
|
||||
|
||||
/**
|
||||
* The Container Factory Interface
|
||||
* The Container Factory Interface
|
||||
*
|
||||
* @since 0.0.0
|
||||
*/
|
||||
interface FactoryInterface
|
||||
{
|
||||
@@ -26,7 +28,7 @@ interface FactoryInterface
|
||||
* @param string $key The container class key
|
||||
*
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
* @since 0.0.0
|
||||
*/
|
||||
public static function _(string $key);
|
||||
|
||||
@@ -34,7 +36,7 @@ interface FactoryInterface
|
||||
* Get the global container
|
||||
*
|
||||
* @return Container
|
||||
* @since 3.2.0
|
||||
* @since 0.0.0
|
||||
*/
|
||||
public static function getContainer(): Container;
|
||||
}
|
||||
|
@@ -109,6 +109,21 @@ interface LoadInterface
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function value(array $select, array $tables, ?array $where = null, ?array $order = null);
|
||||
public function value(array $select, array $tables, ?array $where = null, ?array $order = null);
|
||||
|
||||
/**
|
||||
* Load values from multiple rows
|
||||
*
|
||||
* @param array $select Array of selection keys
|
||||
* @param array $tables Array of tables to search
|
||||
* @param array|null $where Array of where key=>value match exist
|
||||
* @param array|null $order Array of how to order the data
|
||||
* @param int|null $limit Limit the number of values returned
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.2
|
||||
**/
|
||||
public function values(array $select, array $tables, ?array $where = null,
|
||||
?array $order = null, ?int $limit = null): ?array;
|
||||
}
|
||||
|
||||
|
@@ -42,6 +42,19 @@ interface ModelInterface
|
||||
*/
|
||||
public function value($value, string $field, ?string $table = null);
|
||||
|
||||
/**
|
||||
* Model a value of multiple items
|
||||
* Example: $this->items(Array, 'value_key', 'table_name');
|
||||
*
|
||||
* @param array|null $items The array of values
|
||||
* @param string $field The field key
|
||||
* @param string|null $table The table
|
||||
*
|
||||
* @return array|null
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function values(?array $items = null, string $field, ?string $table = null): ?array;
|
||||
|
||||
/**
|
||||
* Model the values of an item
|
||||
* Example: $this->item(Object, 'table_name');
|
||||
|
@@ -29,10 +29,10 @@ interface Registryinterface extends Activeregistryinterface
|
||||
* @param mixed $value Value of entry
|
||||
*
|
||||
* @throws \InvalidArgumentException If any of the path values are not a number or string.
|
||||
* @return $this
|
||||
* @return self
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function set(string $path, $value): static;
|
||||
public function set(string $path, $value): self;
|
||||
|
||||
/**
|
||||
* Adds content into the registry. If a key exists,
|
||||
@@ -45,10 +45,10 @@ interface Registryinterface extends Activeregistryinterface
|
||||
* Override in child class allowed set class property $addAsArray = true.
|
||||
*
|
||||
* @throws \InvalidArgumentException If any of the path values are not a number or string.
|
||||
* @return $this
|
||||
* @return self
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function add(string $path, $value, ?bool $asArray = null): static;
|
||||
public function add(string $path, $value, ?bool $asArray = null): self;
|
||||
|
||||
/**
|
||||
* Retrieves a value (or sub-array) from the registry using multiple keys.
|
||||
@@ -68,10 +68,10 @@ interface Registryinterface extends Activeregistryinterface
|
||||
* @param string $path Registry path (e.g. vdm.content.builder)
|
||||
*
|
||||
* @throws \InvalidArgumentException If any of the path values are not a number or string.
|
||||
* @return $this
|
||||
* @return self
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function remove(string $path): static;
|
||||
public function remove(string $path): self;
|
||||
|
||||
/**
|
||||
* Checks the existence of a particular location in the registry using multiple keys.
|
||||
@@ -89,9 +89,9 @@ interface Registryinterface extends Activeregistryinterface
|
||||
*
|
||||
* @param string|null $value The value to set.
|
||||
*
|
||||
* @return $this
|
||||
* @return self
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function setSeparator(?string $value): static;
|
||||
public function setSeparator(?string $value): self;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user