Skip to content

Commit

Permalink
get rid of deprecated method Platform::getName; include MariaDB as …
Browse files Browse the repository at this point in the history
…a part of MySQLPlatform (#120)

* get rid of deprecated method `Platform::getName`; include MariaDB as a part of MySQLPlatform

* string to ::class

* reverting the dev dependency side effect
  • Loading branch information
someson authored Nov 20, 2024
1 parent ae6e84e commit 03a133d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Doctrine/MySql/UseIndexHintHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use function preg_match_all;
use function preg_quote;
use function preg_replace;
use function sprintf;

class UseIndexHintHandler extends HintHandler
{
Expand All @@ -35,8 +36,8 @@ public function processNode(SqlNode $sqlNode, string $sql): string
$query = $sqlWalker->getQuery();
$platform = $query->getEntityManager()->getConnection()->getDatabasePlatform();

if (!is_a($platform, 'Doctrine\DBAL\Platforms\MySqlPlatform')) { // bypass platform MySqlPlatform => MySQLPlatform rename in dbal
throw new LogicException("Only MySQL platform is supported, {$platform->getName()} given");
if (!is_a($platform, 'Doctrine\DBAL\Platforms\AbstractMySQLPlatform')) {
throw new LogicException(sprintf('Only MySQL platform is supported, %s given', $platform::class));
}

if (!$query->getAST() instanceof SelectStatement) {
Expand Down

0 comments on commit 03a133d

Please sign in to comment.