Skip to content

Commit

Permalink
Simplify PDO query call
Browse files Browse the repository at this point in the history
  • Loading branch information
rey0bs committed Nov 20, 2017
1 parent 874971d commit 2002e52
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions lib/Doctrine/DBAL/Driver/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,8 @@ public function prepare($prepareString, $driverOptions = [])
*/
public function query($sql, ...$args)
{
$argsCount = count($args);

try {
if ($argsCount == 3) {
return parent::query($sql, $args[0], $args[1], $args[2]);
}

if ($argsCount == 2) {
return parent::query($sql, $args[0], $args[1]);
}

if ($argsCount == 1) {
return parent::query($sql, $args[0]);
}

return parent::query($sql);
return parent::query($sql, ...$args);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
Expand Down

0 comments on commit 2002e52

Please sign in to comment.