Skip to content

Commit

Permalink
[TASK] Avoid deprecated doctrine/dbal method 'executeUpdate()'
Browse files Browse the repository at this point in the history
doctrine/dbal deprecated quite some methods to cleanup
their codebase and provided replacements with more
speaking method names.

Most depcrecated method usages have been replaced in
the core, but we missed some.

The patch replaces the depcrecated method 'executeUpdate()'
with the corresponding 'executeStatement()' method in
several places to cleanup this up.

This can be done also in 11.5 too, the required minimum
version of doctrine/dbal provides these new methods as
upwards compatible layer.

Resolves: #96389
Releases: main, 11.5
Change-Id: Ibf8f49a27a1c8c4b34bda88a20f4fba6afe45cb8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72710
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
sbuerk authored and bmack committed Dec 20, 2021
1 parent 7c7705f commit da29e38
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public function delete($tableName, array $identifier, array $types = []): int
*/
public function truncate(string $tableName, bool $cascade = false): int
{
return $this->executeUpdate(
return $this->executeStatement(
$this->getDatabasePlatform()->getTruncateTableSQL(
$this->quoteIdentifier($tableName),
$cascade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function execute(): int
);
}

return $this->connection->executeUpdate($this->getSQL(), $this->parameters, $this->types);
return $this->connection->executeStatement($this->getSQL(), $this->parameters, $this->types);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static function ($columnName) {

foreach ($statements as $statement) {
try {
$this->connection->executeUpdate($statement);
$this->connection->executeStatement($statement);
$result[$statement] = '';
} catch (DBALException $e) {
$result[$statement] = $e->getPrevious()->getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function importStaticData(array $statements, bool $truncate = false): arr

foreach ((array)$perTableStatements as $statement) {
try {
$connection->executeUpdate($statement);
$connection->executeStatement($statement);
$result[$statement] = '';
} catch (DBALException $e) {
$result[$statement] = $e->getPrevious()->getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function dropUnusedField(): void
$toSchema,
$connection->getDatabasePlatform()
);
$connection->executeUpdate($statements[0]);
$connection->executeStatement($statements[0]);
self::assertTrue($this->getTableDetails()->hasColumn('zzz_deleted_testfield'));

$statements = $this->readFixtureFile('newTable');
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function insertQueries(array $args, string $expectedQuery, array $expecte
public function bulkInsert(): void
{
$this->connection->expects(self::once())
->method('executeUpdate')
->method('executeStatement')
->with('INSERT INTO "aTestTable" ("aField") VALUES (?), (?)', ['aValue', 'anotherValue'])
->willReturn(2);

Expand Down Expand Up @@ -504,7 +504,7 @@ public function countQueries(array $args, string $expectedQuery, array $expected
public function truncateQuery(): void
{
$this->connection->expects(self::once())
->method('executeUpdate')
->method('executeStatement')
->with('TRUNCATE "aTestTable"')
->willReturn(0);

Expand Down

0 comments on commit da29e38

Please sign in to comment.