Skip to content

Fix DBAL deprecation #37563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ public function deleteTokenBySeries($series)
$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);
}
}

/**
Expand All @@ -101,7 +105,11 @@ public function updateToken($series, $tokenValue, \DateTime $lastUsed)
'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.');
}
Expand Down Expand Up @@ -129,6 +137,10 @@ public function createNewToken(PersistentTokenInterface $token)
'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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function bootstrapProvider()
'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,
Expand Down
18 changes: 15 additions & 3 deletions src/Symfony/Component/Cache/Traits/PdoTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ public function createTable()
$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;
Expand Down Expand Up @@ -138,7 +142,11 @@ public function createTable()
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);
}
}

/**
Expand Down Expand Up @@ -238,7 +246,11 @@ protected function doClear($namespace)
$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;
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy