Update 2024-07-11 23:11:32

This commit is contained in:
Robot 2024-07-11 23:15:28 +02:00
parent 0160c64a63
commit 5d28565ce7
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
6 changed files with 22 additions and 10 deletions

View File

@ -13,7 +13,7 @@
@startuml
interface MultiSubformInterface #Lavender {
+ get(array $getMap) : ?array
+ set(array $items, array $setMap) : bool
+ set(mixed $items, array $setMap) : bool
}
note right of MultiSubformInterface::get

View File

@ -49,7 +49,7 @@ interface MultiSubformInterface
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
*
* Example:
@ -72,6 +72,6 @@ interface MultiSubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool;
public function set(mixed $items, array $setMap): bool;
}

View File

@ -28,7 +28,7 @@
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
*
* Example:
@ -51,4 +51,4 @@
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool;
public function set(mixed $items, array $setMap): bool;

View File

@ -15,7 +15,7 @@ class MultiSubform << (F,LightGreen) >> #RoyalBlue {
# Subform $subform
+ __construct(Subform $subform)
+ get(array $getMap) : ?array
+ set(array $items, array $setMap) : bool
+ set(mixed $items, array $setMap) : bool
- getSubformData(array $map, ?array $coreData = null) : ?array
- setSubformData(array $items, array $map, ...) : bool
- setLinkValue(string $linkValue, ?array $data = null) : ?string

View File

@ -94,7 +94,7 @@ final class MultiSubform implements MultiSubformInterface
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
*
* Example:
@ -117,7 +117,7 @@ final class MultiSubform implements MultiSubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool
public function set(mixed $items, array $setMap): bool
{
// Validate the core map presence and structure
if (!isset($setMap['_core']) || !is_array($setMap['_core']) || !$this->validSetMap($setMap['_core']))
@ -125,6 +125,12 @@ final class MultiSubform implements MultiSubformInterface
return false;
}
// catch an empty set
if (!is_array($items))
{
$items = []; // will delete all exisitng linked items :( not ideal, but real
}
// Save the core data
if (!$this->setSubformData($items, $setMap['_core']))
{

View File

@ -69,7 +69,7 @@
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
*
* Example:
@ -92,7 +92,7 @@
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool
public function set(mixed $items, array $setMap): bool
{
// Validate the core map presence and structure
if (!isset($setMap['_core']) || !is_array($setMap['_core']) || !$this->validSetMap($setMap['_core']))
@ -100,6 +100,12 @@
return false;
}
// catch an empty set
if (!is_array($items))
{
$items = []; // will delete all exisitng linked items :( not ideal, but real
}
// Save the core data
if (!$this->setSubformData($items, $setMap['_core']))
{