Skip to content

Commit 603ac5d

Browse files
committed
Fix MySQLRepository for DBAL 4.x compatibility
Remove manual connection reconnection logic since DBAL 4.x handles reconnection automatically. The connect() method became protected in DBAL 4.x, causing 'Call to protected method' errors. Changes: - Removed manual ping/close/connect logic from getConnection() - DBAL 4.x automatically handles lost connections and reconnection - Kept ping() method as required by PingableConnection interface This fixes the repository to work with DBAL 4.x while maintaining the same functionality.
1 parent 2496069 commit 603ac5d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/MySQLReplication/Repository/MySQLRepository.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function getFields(string $database, string $table): FieldDTOCollection
3737
`TABLE_SCHEMA` = ?
3838
AND
3939
`TABLE_NAME` = ?
40-
ORDER BY
41-
ORDINAL_POSITION
40+
ORDER BY
41+
ORDINAL_POSITION
4242
';
4343

4444
return FieldDTOCollection::makeFromArray(
@@ -95,11 +95,8 @@ public function ping(Connection $connection): bool
9595

9696
private function getConnection(): Connection
9797
{
98-
if ($this->ping($this->connection) === false) {
99-
$this->connection->close();
100-
$this->connection->connect();
101-
}
102-
98+
// In DBAL 4.x, connections handle reconnection automatically
99+
// No need for manual ping/reconnect logic
103100
return $this->connection;
104101
}
105102
}

0 commit comments

Comments
 (0)