Browse Source

Fix fetching in ORM and tables

Nathaniel van Diepen 6 years ago
parent
commit
46fb1bcf37
2 changed files with 3 additions and 3 deletions
  1. 2 2
      PDO/table.class.php
  2. 1 1
      orm.abstract.class.php

+ 2 - 2
PDO/table.class.php

@@ -405,7 +405,7 @@
 		}
 		public function fetch(array $columns = null, array $filter = null, int $start = null, int $amount = null){
 			$results = [];
-			$this->each(function($row) use($results){
+			$this->each(function($row) use(&$results){
 				$results[] = $row;
 			}, $columns, $filter, $start, $amount);
 			return $results;
@@ -434,4 +434,4 @@
 			return $this->exists ? $this->pdo->exec("select 1 from `{$this->name}` {$this->pdo->stringFilter($filter)}") : 0;
 		}
 	}
-?>
+?>

+ 1 - 1
orm.abstract.class.php

@@ -258,7 +258,7 @@
 		}
 		public static function fetch(array $filter = null, int $start = null, int $amount = null){
 			$results = [];
-			self::each(function($item) use($results){
+			self::each(function($item) use(&$results){
 				$results[] = $item;
 			}, $filter, $start, $amount);
 			return $results;