forked from doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix calls to removed lock methods (doctrine#11061)
- Loading branch information
Showing
6 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\ORM\Utility; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; | ||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Platforms\DB2Platform; | ||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform; | ||
use Doctrine\DBAL\Platforms\SQLitePlatform; | ||
use Doctrine\DBAL\Platforms\SQLServerPlatform; | ||
|
||
/** @internal */ | ||
trait LockSqlHelper | ||
{ | ||
private function getReadLockSQL(AbstractPlatform $platform): string | ||
{ | ||
return match (true) { | ||
$platform instanceof AbstractMySQLPlatform => 'LOCK IN SHARE MODE', | ||
$platform instanceof PostgreSQLPlatform => 'FOR SHARE', | ||
default => $this->getWriteLockSQL($platform), | ||
}; | ||
} | ||
|
||
private function getWriteLockSQL(AbstractPlatform $platform): string | ||
{ | ||
return match (true) { | ||
$platform instanceof DB2Platform => 'WITH RR USE AND KEEP UPDATE LOCKS', | ||
$platform instanceof SQLitePlatform, | ||
$platform instanceof SQLServerPlatform => '', | ||
default => 'FOR UPDATE', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters