Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e26d5f2

Browse filesBrowse files
bug #37169 [Cache] fix forward compatibility with Doctrine DBAL 3 (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [Cache] fix forward compatibility with Doctrine DBAL 3 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36987 (comment) | License | MIT | Doc PR | Commits ------- 316efef fix forward compatibility with Doctrine DBAL 3
2 parents 911c5d5 + 316efef commit e26d5f2
Copy full SHA for e26d5f2

File tree

Expand file treeCollapse file tree

2 files changed

+12
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-8
lines changed

‎src/Symfony/Component/Cache/Tests/Traits/PdoPruneableTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Traits/PdoPruneableTrait.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Traits;
1313

14+
use Doctrine\DBAL\Result;
15+
1416
trait PdoPruneableTrait
1517
{
1618
protected function isPruned($cache, $name)
@@ -27,8 +29,8 @@ protected function isPruned($cache, $name)
2729
/** @var \Doctrine\DBAL\Statement|\PDOStatement $select */
2830
$select = $getPdoConn->invoke($cache)->prepare('SELECT 1 FROM cache_items WHERE item_id LIKE :id');
2931
$select->bindValue(':id', sprintf('%%%s', $name));
30-
$select->execute();
32+
$result = $select->execute();
3133

32-
return 1 !== (int) (method_exists($select, 'fetchOne') ? $select->fetchOne() : $select->fetch(\PDO::FETCH_COLUMN));
34+
return 1 !== (int) ($result instanceof Result ? $result->fetchOne() : $select->fetch(\PDO::FETCH_COLUMN));
3335
}
3436
}

‎src/Symfony/Component/Cache/Traits/PdoTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/PdoTrait.php
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Connection;
1515
use Doctrine\DBAL\DBALException;
1616
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
17+
use Doctrine\DBAL\Result;
1718
use Doctrine\DBAL\Schema\Schema;
1819
use Symfony\Component\Cache\Exception\InvalidArgumentException;
1920

@@ -175,15 +176,16 @@ protected function doFetch(array $ids)
175176
foreach ($ids as $id) {
176177
$stmt->bindValue(++$i, $id);
177178
}
178-
$stmt->execute();
179+
$result = $stmt->execute();
179180

180-
if (method_exists($stmt, 'iterateNumeric')) {
181-
$stmt = $stmt->iterateNumeric();
181+
if ($result instanceof Result) {
182+
$result = $result->iterateNumeric();
182183
} else {
183184
$stmt->setFetchMode(\PDO::FETCH_NUM);
185+
$result = $stmt;
184186
}
185187

186-
foreach ($stmt as $row) {
188+
foreach ($result as $row) {
187189
if (null === $row[1]) {
188190
$expired[] = $row[0];
189191
} else {
@@ -213,9 +215,9 @@ protected function doHave($id)
213215

214216
$stmt->bindValue(':id', $id);
215217
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
216-
$stmt->execute();
218+
$result = $stmt->execute();
217219

218-
return (bool) $stmt->fetchColumn();
220+
return (bool) ($result instanceof Result ? $result->fetchOne() : $stmt->fetchColumn());
219221
}
220222

221223
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.