diff --git a/src/QueryResult.php b/src/QueryResult.php index 8600722..629912a 100644 --- a/src/QueryResult.php +++ b/src/QueryResult.php @@ -156,9 +156,9 @@ public function yieldObject(string $fetchClassName) } $column = $this->getColumns(); $columnCount = count($column); - $reflectionClass = new \ReflectionClass($fetchClassName); - $newInstance = $reflectionClass->newInstanceWithoutConstructor(); foreach ($this->data as $data) { + $reflectionClass = new \ReflectionClass($fetchClassName); + $newInstance = $reflectionClass->newInstanceWithoutConstructor(); for ($i = 0; $i < $columnCount; $i++) { if ($reflectionClass->hasProperty($column[$i]->getName())) { $property = $reflectionClass->getProperty($column[$i]->getName());