Skip to content

Commit e563c3d

Browse files
committed
Bug fix
1 parent 80a9c21 commit e563c3d

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
],
1111
"require": {
1212
"php": "^5.6",
13-
"pechynho/php-utils": "dev-old-php@dev"
13+
"pechynho/php-utils": "dev-old-php@dev",
14+
"ext-pdo": "*"
1415
},
1516
"autoload": {
1617
"psr-4": {

src/DbWrap.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,8 @@ public function iterate($table, $criteria, $orderBy = null, $batchSize = 500)
281281
throw new InvalidArgumentException('Parameter $batchSize has to be NULL or an integer.');
282282
}
283283
$query = "SELECT * FROM $table ";
284-
$this->appendCriteriaToQuery($query, $criteria);
285-
if (!empty($orderBy))
286-
{
287-
$query .= "ORDER BY ";
288-
foreach ($orderBy as $column => $direction)
289-
{
290-
$query .= "`$column` $direction, ";
291-
}
292-
$query = Strings::substring($query, 0, Strings::length($query) - 2);
293-
$query .= " ";
294-
}
284+
$query = $this->appendCriteriaToQuery($query, $criteria);
285+
$query = $this->appendOrderByToQuery($query, $orderBy);
295286
return $this->iterateQuery($query, $criteria, $batchSize);
296287
}
297288

0 commit comments

Comments
 (0)