Make sure that `readObjects` is only executed once
authorMarcel Werk <burntime@woltlab.com>
Thu, 12 Dec 2024 16:13:40 +0000 (17:13 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 12 Dec 2024 16:13:40 +0000 (17:13 +0100)
wcfsetup/install/files/lib/system/gridView/DatabaseObjectListGridView.class.php

index 448668ea3ef25139171566f58f4c1dc8d362c4aa..28140d6891a637d3b843c1cfb31e806e1f18db05 100644 (file)
@@ -18,16 +18,20 @@ abstract class DatabaseObjectListGridView extends AbstractGridView
 {
     protected DatabaseObjectList $objectList;
     private int $objectCount;
-    public int $counter = 0;
+    /**
+     * @var DatabaseObject[]
+     */
+    private array $objects;
 
     #[\Override]
     public function getRows(): array
     {
-        $this->getObjectList()->readObjects();
-
-        $this->counter++;
+        if (!isset($this->objects)) {
+            $this->getObjectList()->readObjects();
+            $this->objects = $this->getObjectList()->getObjects();
+        }
 
-        return $this->getObjectList()->getObjects();
+        return $this->objects;
     }
 
     #[\Override]