Fix DBAL deprecation
This commit is contained in:
parent
a56f6482a5
commit
4273aedfae
@ -81,8 +81,12 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
||||
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
|
||||
$paramValues = ['series' => $series];
|
||||
$paramTypes = ['series' => \PDO::PARAM_STR];
|
||||
if (method_exists($this->conn, 'executeStatement')) {
|
||||
$this->conn->executeStatement($sql, $paramValues, $paramTypes);
|
||||
} else {
|
||||
$this->conn->executeUpdate($sql, $paramValues, $paramTypes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -101,7 +105,11 @@ class DoctrineTokenProvider implements TokenProviderInterface
|
||||
'lastUsed' => self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE,
|
||||
'series' => \PDO::PARAM_STR,
|
||||
];
|
||||
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,
|
||||
];
|
||||
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,8 +107,12 @@ trait PdoTrait
|
||||
$table->setPrimaryKey([$this->idCol]);
|
||||
|
||||
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -138,8 +142,12 @@ trait PdoTrait
|
||||
throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver));
|
||||
}
|
||||
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -238,7 +246,11 @@ trait PdoTrait
|
||||
$sql = "DELETE FROM $this->table WHERE $this->idCol LIKE '$namespace%'";
|
||||
}
|
||||
|
||||
if (method_exists($conn, 'executeStatement')) {
|
||||
$conn->executeStatement($sql);
|
||||
} else {
|
||||
$conn->exec($sql);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user