diff --git a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/README.md b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/README.md index 992f547..609581b 100644 --- a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/README.md +++ b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/README.md @@ -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 diff --git a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.php b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.php index 285318d..3beb532 100644 --- a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.php +++ b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.php @@ -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; } diff --git a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.power b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.power index 4a3addc..ff0caba 100644 --- a/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.power +++ b/src/bb30f709-53d2-446a-ab3d-300fe6de0bc8/code.power @@ -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; \ No newline at end of file + public function set(mixed $items, array $setMap): bool; \ No newline at end of file diff --git a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/README.md b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/README.md index e8464e9..5e5a4a0 100644 --- a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/README.md +++ b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/README.md @@ -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 diff --git a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php index e875d2b..f1aca34 100644 --- a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php +++ b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php @@ -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'])) { diff --git a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.power b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.power index 777c31b..4a9e127 100644 --- a/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.power +++ b/src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.power @@ -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'])) {