Skip to content

Commit e027e7e

Browse files
committed
Type check queries in find
1 parent 8e40af9 commit e027e7e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Database/Adapter/SQL.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Utopia\Database\Document;
1010
use Utopia\Database\Exception as DatabaseException;
1111
use Utopia\Database\Exception\NotFound as NotFoundException;
12+
use Utopia\Database\Exception\Query as QueryException;
1213
use Utopia\Database\Exception\Transaction as TransactionException;
13-
use Utopia\Database\PDO;
1414
use Utopia\Database\Query;
1515

1616
abstract class SQL extends Adapter
@@ -1605,6 +1605,9 @@ public function getSQLConditions(array $queries, array &$binds, string $separato
16051605
{
16061606
$conditions = [];
16071607
foreach ($queries as $query) {
1608+
if (!$query instanceof Query) {
1609+
throw new QueryException('Invalid query type: "' . \gettype($query) . '". Expected instances of "' . Query::class . '"');
1610+
}
16081611

16091612
if ($query->getMethod() === Query::TYPE_SELECT) {
16101613
continue;

0 commit comments

Comments
 (0)