Fix DBAL deprecation
This commit is contained in:
parent
a56f6482a5
commit
4273aedfae
|
@ -81,7 +81,11 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
|
||||
$paramValues = ['series' => $series];
|
||||
$paramTypes = ['series' => \PDO::PARAM_STR];
|
||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
if (method_exists($this->conn, 'executeStatement')) {
|
||||
$this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||
} else {
|
||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +105,11 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
||||
'series' => \PDO::PARAM_STR,
|
||||
];
|
||||
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
if (method_exists($this->conn, 'executeStatement')) {
|
||||
$updated = $this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||
} else {
|
||||
$updated = $this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
}
|
||||
if ($updated < 1) {
|
||||
throw new TokenNotFoundException('No token found.');
|
||||
}
|
||||
|
@ -129,6 +137,10 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
|||
'value' => \PDO::PARAM_STR,
|
||||
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
||||
];
|
||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
if (method_exists($this->conn, 'executeStatement')) {
|
||||
$this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||
} else {
|
||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class DoctrineTokenProviderTest extends TestCase
|
|||
'driver' => 'pdo_sqlite',
|
||||
'url' => 'sqlite:///:memory:',
|
||||
]);
|
||||
$connection->executeUpdate(<<< 'SQL'
|
||||
$connection->{method_exists($this->conn, 'executeStatement') ? 'executeStatement' : 'executeUpdate'}(<<< 'SQL'
|
||||
CREATE TABLE rememberme_token (
|
||||
series char(88) UNIQUE PRIMARY KEY NOT NULL,
|
||||
value char(88) NOT NULL,
|
||||
|
|
|
@ -107,7 +107,11 @@ trait PdoTrait
|
|||
$table->setPrimaryKey([$this->idCol]);
|
||||
|
||||
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
||||
$conn->exec($sql);
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -138,7 +142,11 @@ trait PdoTrait
|
|||
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
|
||||
}
|
||||
|
||||
$conn->exec($sql);
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,7 +246,11 @@ trait PdoTrait
|
|||
$sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'";
|
||||
}
|
||||
|
||||
$conn->exec($sql);
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Reference in New Issue