Fix Doctrine deprecations (#4608)
This commit is contained in:
2
.github/workflows/testing.yaml
vendored
2
.github/workflows/testing.yaml
vendored
@@ -47,7 +47,7 @@ jobs:
|
|||||||
run: echo "composer_cache_directory=$(composer config cache-dir)" >> $GITHUB_ENV
|
run: echo "composer_cache_directory=$(composer config cache-dir)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Cache Composer dependencies
|
- name: Cache Composer dependencies
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: "${{ env.composer_cache_directory }}"
|
path: "${{ env.composer_cache_directory }}"
|
||||||
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
||||||
|
|||||||
683
composer.lock
generated
683
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ doctrine:
|
|||||||
charset: utf8mb4
|
charset: utf8mb4
|
||||||
default_table_options:
|
default_table_options:
|
||||||
charset: utf8mb4
|
charset: utf8mb4
|
||||||
collate: utf8mb4_unicode_ci
|
collation: utf8mb4_unicode_ci
|
||||||
schema_manager_factory: doctrine.dbal.default_schema_manager_factory
|
schema_manager_factory: doctrine.dbal.default_schema_manager_factory
|
||||||
|
|
||||||
types:
|
types:
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ doctrine_migrations:
|
|||||||
table_name: 'migration_versions'
|
table_name: 'migration_versions'
|
||||||
migrations_paths:
|
migrations_paths:
|
||||||
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
||||||
|
custom_template: '%kernel.project_dir%/migrations/MigrationTemplate.txt'
|
||||||
34
migrations/MigrationTemplate.txt
Normal file
34
migrations/MigrationTemplate.txt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai time-tracking app.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use App\Doctrine\AbstractMigration;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 2.x
|
||||||
|
*/
|
||||||
|
final class <className> extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
<up>
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
<down>
|
||||||
|
}<override>
|
||||||
|
}
|
||||||
@@ -51,9 +51,4 @@ final class Version20230327143628 extends AbstractMigration
|
|||||||
$workingTimes->removeForeignKey('FK_F95E49334EA3CB3D');
|
$workingTimes->removeForeignKey('FK_F95E49334EA3CB3D');
|
||||||
$schema->dropTable('kimai2_working_times');
|
$schema->dropTable('kimai2_working_times');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isTransactional(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,4 @@ final class Version20230606125948 extends AbstractMigration
|
|||||||
$tags = $schema->getTable('kimai2_tags');
|
$tags = $schema->getTable('kimai2_tags');
|
||||||
$tags->dropColumn('visible');
|
$tags->dropColumn('visible');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isTransactional(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DoctrineMigrations;
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use App\Doctrine\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 2.0.31
|
* @version 2.0.31
|
||||||
@@ -40,9 +40,4 @@ final class Version20230819090536 extends AbstractMigration
|
|||||||
$table->dropIndex('IDX_B9AC5BCE19E9AC5F');
|
$table->dropIndex('IDX_B9AC5BCE19E9AC5F');
|
||||||
$table->dropColumn('supervisor_id');
|
$table->dropColumn('supervisor_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isTransactional(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DoctrineMigrations;
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use App\Doctrine\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 2.5.0
|
* @version 2.5.0
|
||||||
@@ -34,10 +34,6 @@ final class Version20231130000719 extends AbstractMigration
|
|||||||
|
|
||||||
public function down(Schema $schema): void
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
}
|
$this->preventEmptyMigrationWarning();
|
||||||
|
|
||||||
public function isTransactional(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ abstract class AbstractMigration extends BaseAbstractMigration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Schema $schema
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function preUp(Schema $schema): void
|
public function preUp(Schema $schema): void
|
||||||
@@ -39,7 +38,6 @@ abstract class AbstractMigration extends BaseAbstractMigration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Schema $schema
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function preDown(Schema $schema): void
|
public function preDown(Schema $schema): void
|
||||||
@@ -52,7 +50,7 @@ abstract class AbstractMigration extends BaseAbstractMigration
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function abortIfPlatformNotSupported(): void
|
private function abortIfPlatformNotSupported(): void
|
||||||
{
|
{
|
||||||
$platform = $this->connection->getDatabasePlatform();
|
$platform = $this->connection->getDatabasePlatform();
|
||||||
if (!($platform instanceof MySQLPlatform)) {
|
if (!($platform instanceof MySQLPlatform)) {
|
||||||
|
|||||||
64
src/Doctrine/DsnParserFactory.php
Normal file
64
src/Doctrine/DsnParserFactory.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Kimai time-tracking app.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Doctrine;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
use Doctrine\DBAL\Tools\DsnParser;
|
||||||
|
|
||||||
|
final class DsnParserFactory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Copied here from Doctrine v3 DriverManager, as they are going to be removed in Doctrine 4.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
private static array $driverSchemeAliases = [
|
||||||
|
'db2' => 'ibm_db2',
|
||||||
|
'mssql' => 'pdo_sqlsrv',
|
||||||
|
'mysql' => 'pdo_mysql',
|
||||||
|
'mysql2' => 'pdo_mysql', // Amazon RDS, for some weird reason
|
||||||
|
'postgres' => 'pdo_pgsql',
|
||||||
|
'postgresql' => 'pdo_pgsql',
|
||||||
|
'pgsql' => 'pdo_pgsql',
|
||||||
|
'sqlite' => 'pdo_sqlite',
|
||||||
|
'sqlite3' => 'pdo_sqlite',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function create(): DsnParser
|
||||||
|
{
|
||||||
|
return new DsnParser(self::$driverSchemeAliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, array<mixed>|bool|AbstractPlatform|int|string>
|
||||||
|
*/
|
||||||
|
public function parse(
|
||||||
|
#[\SensitiveParameter]
|
||||||
|
string $dsn
|
||||||
|
): array
|
||||||
|
{
|
||||||
|
// see https://github.com/doctrine/dbal/pull/5843
|
||||||
|
|
||||||
|
$options = $this->create()->parse($dsn);
|
||||||
|
|
||||||
|
$options = array_merge(
|
||||||
|
$options,
|
||||||
|
[
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'defaultTableOptions' => [
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user