From f1664eb2b07ef8ec666599940575aa1664149fbb Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 19 May 2022 19:59:57 +0200 Subject: [PATCH] wip #4285 --- src/app/Magic/Fields/BunchOfFieldsMultiple.php | 2 ++ src/app/Magic/InterfaceBunchOfFields.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/app/Magic/Fields/BunchOfFieldsMultiple.php b/src/app/Magic/Fields/BunchOfFieldsMultiple.php index 309e4e8..3593b56 100644 --- a/src/app/Magic/Fields/BunchOfFieldsMultiple.php +++ b/src/app/Magic/Fields/BunchOfFieldsMultiple.php @@ -49,7 +49,9 @@ class BunchOfFieldsMultiple extends BunchOfFields implements InterfaceBunchOfFie } if (is_string($bunch)) { if (class_exists($bunch)) { + /** @var InterfaceBunchOfFields $bunchInstance */ $bunchInstance = new $bunch(); + $bunchInstance->setRootEntry($this->getRootEntry()); if (method_exists($bunchInstance, 'getFields')) { $this->_fields = $bunchInstance->getFields(); } diff --git a/src/app/Magic/InterfaceBunchOfFields.php b/src/app/Magic/InterfaceBunchOfFields.php index 851f5b0..425a6d0 100644 --- a/src/app/Magic/InterfaceBunchOfFields.php +++ b/src/app/Magic/InterfaceBunchOfFields.php @@ -37,4 +37,14 @@ interface InterfaceBunchOfFields * @return bool */ public function hasField($name): bool; + + /** + * @return InterfaceBunchOfFields + */ + public function getRootEntry(): ?InterfaceBunchOfFields; + + /** + * @param InterfaceBunchOfFields $rootEntry + */ + public function setRootEntry(InterfaceBunchOfFields $rootEntry): void; } -- 2.39.5