From f3456464810ec0e9d4cffbf2d22886ee41a807fc Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:43:08 +1200 Subject: [PATCH] FIX Allow subclasses of ManyMany lists in EagerLoadedList (#10905) --- src/ORM/EagerLoadedList.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ORM/EagerLoadedList.php b/src/ORM/EagerLoadedList.php index 77b21fcad..6f2cf09cc 100644 --- a/src/ORM/EagerLoadedList.php +++ b/src/ORM/EagerLoadedList.php @@ -889,7 +889,7 @@ class EagerLoadedList extends ViewableData implements Relation, SS_List, Filtera */ public function getExtraData($componentName, int|string $itemID): array { - if (!in_array(get_class($this->dataList), [ManyManyList::class, ManyManyThroughList::class])) { + if (!($this->dataList instanceof ManyManyList) && !($this->dataList instanceof ManyManyThroughList)) { throw new BadMethodCallException('Cannot have extra fields on this list type'); } @@ -926,7 +926,7 @@ class EagerLoadedList extends ViewableData implements Relation, SS_List, Filtera */ public function getExtraFields(): array { - if (!in_array(get_class($this->dataList), [ManyManyList::class, ManyManyThroughList::class])) { + if (!($this->dataList instanceof ManyManyList) && !($this->dataList instanceof ManyManyThroughList)) { throw new BadMethodCallException('Cannot have extra fields on this list type'); } return $this->extraFields;