Skip to content

Commit

Permalink
Merge branch '2.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 30, 2022
2 parents 2083682 + 2617ee2 commit 057ad0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Source/DoctrineDBALConnectionSourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace Sonata\Exporter\Source;

use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Result;

/**
* @phpstan-implements \Iterator<array<mixed>>
Expand Down Expand Up @@ -72,7 +72,7 @@ public function rewind(): void
{
$statement = $this->connection->prepare($this->query);

$this->result = $statement->execute($this->parameters);
$this->result = $statement->executeQuery($this->parameters);

$this->next();
}
Expand Down
8 changes: 1 addition & 7 deletions tests/Source/DoctrineDBALConnectionSourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@ protected function setUp(): void
}
}

/**
* @psalm-suppress DeprecatedMethod
*
* @see https://github.com/doctrine/dbal/pull/4966#issuecomment-1140517232
*/
public function testRewindWithEmptyQuery(): void
{
$connection = DriverManager::getConnection(['url' => 'sqlite:///:memory:']);
$driverConnection = $connection->getWrappedConnection();

$iterator = new DoctrineDBALConnectionSourceIterator($driverConnection, ' ');
$iterator = new DoctrineDBALConnectionSourceIterator($connection, ' ');
$iterator->rewind();

static::assertCount(0, iterator_to_array($iterator));
Expand Down

0 comments on commit 057ad0e

Please sign in to comment.