diff --git a/composer.json b/composer.json index 27ecaed05..64764d2fb 100644 --- a/composer.json +++ b/composer.json @@ -28,14 +28,14 @@ "ext-xmlreader": "*", "ext-xmlwriter": "*", "azuracast/nowplaying": "dev-main", - "beberlei/doctrineextensions": "^1.4", + "beberlei/doctrineextensions": "^1.5", "br33f/php-ga4-mp": "^0.1.2", "brick/math": "^0.11", "composer/ca-bundle": "^1.2", "doctrine/data-fixtures": "^1.3", - "doctrine/dbal": "^3", + "doctrine/dbal": "^4", "doctrine/migrations": "^3.0", - "doctrine/orm": "^2.6", + "doctrine/orm": "^3", "dragonmantank/cron-expression": "^3.1", "gettext/gettext": "^5", "gettext/php-scanner": "^1.3", diff --git a/composer.lock b/composer.lock index d6364a820..f766cd1ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e3e3e88098bbfee794623d5bce712c1d", + "content-hash": "07926bf019ddd0aa3c33377e833d914f", "packages": [ { "name": "aws/aws-crt-php", @@ -227,30 +227,32 @@ }, { "name": "beberlei/doctrineextensions", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/beberlei/DoctrineExtensions.git", - "reference": "249eab82aa35b65741388f38499b3162403d9956" + "reference": "281f1650641c2f438b0a54d8eaa7ba50ac7e3eb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/249eab82aa35b65741388f38499b3162403d9956", - "reference": "249eab82aa35b65741388f38499b3162403d9956", + "url": "https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/281f1650641c2f438b0a54d8eaa7ba50ac7e3eb6", + "reference": "281f1650641c2f438b0a54d8eaa7ba50ac7e3eb6", "shasum": "" }, "require": { - "doctrine/orm": "^2.15", + "doctrine/orm": "^2.19 || ^3.0", "php": "^7.2 || ^8.0" }, "require-dev": { "doctrine/annotations": "^1.14 || ^2", "doctrine/coding-standard": "^9.0.2 || ^12.0", - "nesbot/carbon": "*", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "nesbot/carbon": "^2.72 || ^3", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5 || ^9.6", "squizlabs/php_codesniffer": "^3.8", - "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", - "symfony/yaml": "^4.4 || ^5.3 || ^6.0 || ^7.0", + "symfony/cache": "^5.4 || ^6.4 || ^7.0", + "symfony/yaml": "^5.4 || ^6.4 || ^7.0", + "vimeo/psalm": "^3.18 || ^5.22", "zf1/zend-date": "^1.12", "zf1/zend-registry": "^1.12" }, @@ -281,9 +283,9 @@ "orm" ], "support": { - "source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.4.0" + "source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.5.0" }, - "time": "2024-02-05T17:02:44+00:00" + "time": "2024-03-03T17:55:15+00:00" }, { "name": "br33f/php-ga4-mp", @@ -389,26 +391,26 @@ }, { "name": "carbonphp/carbon-doctrine-types", - "version": "2.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", - "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb" + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", - "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" + "php": "^8.1" }, "conflict": { - "doctrine/dbal": "<3.7.0 || >=4.0.0" + "doctrine/dbal": "<4.0.0 || >=5.0.0" }, "require-dev": { - "doctrine/dbal": "^3.7.0", + "doctrine/dbal": "^4.0.0", "nesbot/carbon": "^2.71.0 || ^3.0.0", "phpunit/phpunit": "^10.3" }, @@ -438,7 +440,7 @@ ], "support": { "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", - "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.1.0" + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" }, "funding": [ { @@ -454,7 +456,7 @@ "type": "tidelift" } ], - "time": "2023-12-11T17:09:12+00:00" + "time": "2024-02-09T16:56:22+00:00" }, { "name": "composer/ca-bundle", @@ -594,99 +596,6 @@ }, "time": "2023-07-18T20:41:43+00:00" }, - { - "name": "doctrine/cache", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", - "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/2.2.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", - "type": "tidelift" - } - ], - "time": "2022-05-20T20:07:39+00:00" - }, { "name": "doctrine/collections", "version": "2.2.0", @@ -773,97 +682,6 @@ ], "time": "2024-02-25T22:55:36+00:00" }, - { - "name": "doctrine/common", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/8b5e5650391f851ed58910b3e3d48a71062eeced", - "reference": "8b5e5650391f851ed58910b3e3d48a71062eeced", - "shasum": "" - }, - "require": { - "doctrine/persistence": "^2.0 || ^3.0", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9.0 || ^10.0", - "doctrine/collections": "^1", - "phpstan/phpstan": "^1.4.1", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/phpunit-bridge": "^6.1", - "vimeo/psalm": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.", - "homepage": "https://www.doctrine-project.org/projects/common.html", - "keywords": [ - "common", - "doctrine", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/common/issues", - "source": "https://github.com/doctrine/common/tree/3.4.3" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcommon", - "type": "tidelift" - } - ], - "time": "2022-10-09T11:47:59+00:00" - }, { "name": "doctrine/data-fixtures", "version": "1.7.0", @@ -950,47 +768,42 @@ }, { "name": "doctrine/dbal", - "version": "3.8.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "a19a1d05ca211f41089dffcc387733a6875196cb" + "reference": "9e588fe1f38a443cb17de6b86b803d9e028e2156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/a19a1d05ca211f41089dffcc387733a6875196cb", - "reference": "a19a1d05ca211f41089dffcc387733a6875196cb", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9e588fe1f38a443cb17de6b86b803d9e028e2156", + "reference": "9e588fe1f38a443cb17de6b86b803d9e028e2156", "shasum": "" }, "require": { - "composer-runtime-api": "^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/deprecations": "^0.5.3|^1", - "doctrine/event-manager": "^1|^2", - "php": "^7.4 || ^8.0", + "php": "^8.1", "psr/cache": "^1|^2|^3", "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", - "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.10.57", + "jetbrains/phpstorm-stubs": "2023.2", + "phpstan/phpstan": "1.10.58", + "phpstan/phpstan-phpunit": "1.3.15", "phpstan/phpstan-strict-rules": "^1.5", - "phpunit/phpunit": "9.6.16", + "phpunit/phpunit": "10.5.9", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.8.1", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/console": "^4.4|^5.4|^6.0|^7.0", - "vimeo/psalm": "4.30.0" + "squizlabs/php_codesniffer": "3.9.0", + "symfony/cache": "^6.3.8|^7.0", + "symfony/console": "^5.4|^6.3|^7.0", + "vimeo/psalm": "5.21.1" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "bin": [ - "bin/doctrine-dbal" - ], "type": "library", "autoload": { "psr-4": { @@ -1043,7 +856,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.2" + "source": "https://github.com/doctrine/dbal/tree/4.0.1" }, "funding": [ { @@ -1059,7 +872,7 @@ "type": "tidelift" } ], - "time": "2024-02-12T18:36:36+00:00" + "time": "2024-03-03T15:59:11+00:00" }, { "name": "doctrine/deprecations", @@ -1541,61 +1354,48 @@ }, { "name": "doctrine/orm", - "version": "2.18.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "52a6a21387380b09419a66a7ec1c66f6cab69b20" + "reference": "716fc97b70cf8116f74eaa0588eef51420874bf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/52a6a21387380b09419a66a7ec1c66f6cab69b20", - "reference": "52a6a21387380b09419a66a7ec1c66f6cab69b20", + "url": "https://api.github.com/repos/doctrine/orm/zipball/716fc97b70cf8116f74eaa0588eef51420874bf9", + "reference": "716fc97b70cf8116f74eaa0588eef51420874bf9", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/cache": "^1.12.1 || ^2.1.1", - "doctrine/collections": "^1.5 || ^2.1", - "doctrine/common": "^3.0.3", - "doctrine/dbal": "^2.13.1 || ^3.2", + "doctrine/collections": "^2.2", + "doctrine/dbal": "^3.8.2 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3 || ^2", - "doctrine/lexer": "^2 || ^3", - "doctrine/persistence": "^2.4 || ^3", + "doctrine/lexer": "^3", + "doctrine/persistence": "^3.3.1", "ext-ctype": "*", - "php": "^7.1 || ^8.0", + "php": "^8.1", "psr/cache": "^1 || ^2 || ^3", - "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", - "symfony/polyfill-php72": "^1.23", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/annotations": "<1.13 || >= 3.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/var-exporter": "~6.2.13 || ^6.3.2 || ^7.0" }, "require-dev": { - "doctrine/annotations": "^1.13 || ^2", - "doctrine/coding-standard": "^9.0.2 || ^12.0", - "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.59", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "doctrine/coding-standard": "^12.0", + "phpbench/phpbench": "^1.0", + "phpstan/phpstan": "1.10.59", + "phpunit/phpunit": "^10.4.0", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", - "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", - "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.22.2" + "symfony/cache": "^5.4 || ^6.2 || ^7.0", + "vimeo/psalm": "5.22.2" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", - "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", - "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0" }, - "bin": [ - "bin/doctrine" - ], "type": "library", "autoload": { "psr-4": { @@ -1636,9 +1436,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.18.2" + "source": "https://github.com/doctrine/orm/tree/3.1.0" }, - "time": "2024-03-01T09:47:18+00:00" + "time": "2024-03-03T17:45:20+00:00" }, { "name": "doctrine/persistence", @@ -11201,20 +11001,21 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -11255,9 +11056,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -14361,16 +14168,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -14399,7 +14206,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -14407,7 +14214,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], diff --git a/config/services.php b/config/services.php index 675b9a1ee..1654c8a78 100644 --- a/config/services.php +++ b/config/services.php @@ -60,10 +60,40 @@ return [ GuzzleHttp\Client::class => static fn(App\Service\GuzzleFactory $guzzleFactory) => $guzzleFactory->buildClient(), // DBAL - Doctrine\DBAL\Connection::class => static fn(Doctrine\ORM\EntityManagerInterface $em) => $em->getConnection(), + Doctrine\DBAL\Connection::class => static function ( + Environment $environment, + Psr\Cache\CacheItemPoolInterface $psr6Cache, + ) { + $dbSettings = $environment->getDatabaseSettings(); + if (isset($dbSettings['unix_socket'])) { + unset($dbSettings['host'], $dbSettings['port']); + } + + $connectionOptions = [ + ...$dbSettings, + 'driver' => 'pdo_mysql', + 'charset' => 'utf8mb4', + 'defaultTableOptions' => [ + 'charset' => 'utf8mb4', + 'collate' => 'utf8mb4_general_ci', + ], + 'driverOptions' => [ + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_general_ci', + PDO::MYSQL_ATTR_LOCAL_INFILE => true, + ], + 'serverVersion' => '11.2.3-MariaDB-1', + ]; + + $config = new Doctrine\DBAL\Configuration(); + $config->setResultCache($psr6Cache); + + /** @phpstan-ignore-next-line */ + return Doctrine\DBAL\DriverManager::getConnection($connectionOptions, $config); + }, // Doctrine Entity Manager App\Doctrine\DecoratedEntityManager::class => static function ( + Doctrine\DBAL\Connection $connection, Psr\Cache\CacheItemPoolInterface $psr6Cache, Environment $environment, App\Doctrine\Event\StationRequiresRestart $eventRequiresRestart, @@ -77,30 +107,6 @@ return [ $psr6Cache = new Symfony\Component\Cache\Adapter\ProxyAdapter($psr6Cache, 'doctrine.'); } - $dbSettings = $environment->getDatabaseSettings(); - if (isset($dbSettings['unix_socket'])) { - unset($dbSettings['host'], $dbSettings['port']); - } - - $connectionOptions = array_merge( - $dbSettings, - [ - 'driver' => 'pdo_mysql', - 'charset' => 'utf8mb4', - 'defaultTableOptions' => [ - 'charset' => 'utf8mb4', - 'collate' => 'utf8mb4_general_ci', - ], - 'driverOptions' => [ - // PDO::MYSQL_ATTR_INIT_COMMAND = 1002; - 1002 => 'SET NAMES utf8mb4 COLLATE utf8mb4_general_ci', - // PDO::MYSQL_ATTR_LOCAL_INFILE = 1001 - 1001 => true, - ], - 'platform' => new Doctrine\DBAL\Platforms\MariaDb1027Platform(), - ] - ); - $mappingClassesPaths = [$environment->getBaseDirectory() . '/src/Entity']; $buildDoctrineMappingPathsEvent = new Event\BuildDoctrineMappingPaths( @@ -120,7 +126,7 @@ return [ ); $config->setAutoGenerateProxyClasses( - Doctrine\Common\Proxy\AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS_OR_CHANGED + Doctrine\ORM\Proxy\ProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS_OR_CHANGED ); // Debug mode: @@ -139,7 +145,7 @@ return [ $eventManager->addEventSubscriber($eventChangeTracking); return new App\Doctrine\DecoratedEntityManager( - fn() => Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager) + fn() => new Doctrine\ORM\EntityManager($connection, $config, $eventManager) ); }, diff --git a/src/Doctrine/Event/AuditLog.php b/src/Doctrine/Event/AuditLog.php index cfb7fba39..0990f7b6e 100644 --- a/src/Doctrine/Event/AuditLog.php +++ b/src/Doctrine/Event/AuditLog.php @@ -10,11 +10,10 @@ use App\Entity\AuditLog as AuditLogEntity; use App\Entity\Enums\AuditLogOperations; use App\Entity\Interfaces\IdentifiableEntityInterface; use Doctrine\Common\EventSubscriber; -use Doctrine\Common\Util\ClassUtils; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Events; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Proxy\DefaultProxyClassNameResolver; use Doctrine\ORM\UnitOfWork; use ReflectionClass; use ReflectionObject; @@ -159,7 +158,7 @@ final class AuditLog implements EventSubscriber // Ignore inverse side or one to many relations $mapping = $collection->getMapping(); - if (!$mapping['isOwningSide'] || $mapping['type'] !== ClassMetadataInfo::MANY_TO_MANY) { + if (!$mapping->isOwningSide() || !$mapping->isManyToMany()) { continue; } @@ -199,7 +198,7 @@ final class AuditLog implements EventSubscriber // Ignore inverse side or one to many relations $mapping = $collection->getMapping(); - if (!$mapping['isOwningSide'] || $mapping['type'] !== ClassMetadataInfo::MANY_TO_MANY) { + if (!$mapping->isOwningSide() || !$mapping->isManyToMany()) { continue; } @@ -244,7 +243,7 @@ final class AuditLog implements EventSubscriber private function isEntity(EntityManagerInterface $em, mixed $class): bool { if (is_object($class)) { - $class = ClassUtils::getClass($class); + $class = DefaultProxyClassNameResolver::getClass($class); } if (!is_string($class)) { diff --git a/src/Doctrine/Event/SetExplicitChangeTracking.php b/src/Doctrine/Event/SetExplicitChangeTracking.php index f07ba1f43..baf65c04d 100644 --- a/src/Doctrine/Event/SetExplicitChangeTracking.php +++ b/src/Doctrine/Event/SetExplicitChangeTracking.php @@ -7,7 +7,7 @@ namespace App\Doctrine\Event; use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\LoadClassMetadataEventArgs; use Doctrine\ORM\Events; -use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\ClassMetadata; final class SetExplicitChangeTracking implements EventSubscriber { @@ -25,7 +25,7 @@ final class SetExplicitChangeTracking implements EventSubscriber { $classMetadata = $args->getClassMetadata(); $classMetadata->setChangeTrackingPolicy( - ClassMetadataInfo::CHANGETRACKING_DEFERRED_EXPLICIT + ClassMetadata::CHANGETRACKING_DEFERRED_EXPLICIT ); } } diff --git a/src/Doctrine/Generator/UuidV6Generator.php b/src/Doctrine/Generator/UuidV6Generator.php index d68683ad9..3a82c5db8 100644 --- a/src/Doctrine/Generator/UuidV6Generator.php +++ b/src/Doctrine/Generator/UuidV6Generator.php @@ -19,7 +19,7 @@ final class UuidV6Generator extends AbstractIdGenerator $this->factory = clone Uuid::getFactory(); } - public function generateId(EntityManagerInterface $em, $entity) + public function generateId(EntityManagerInterface $em, object|null $entity): mixed { $nodeProvider = new RandomNodeProvider(); return $this->factory->uuid6($nodeProvider->getNode())->toString(); diff --git a/src/Entity/Migration/Traits/UpdateAllRecords.php b/src/Entity/Migration/Traits/UpdateAllRecords.php index 348f87034..56682c500 100644 --- a/src/Entity/Migration/Traits/UpdateAllRecords.php +++ b/src/Entity/Migration/Traits/UpdateAllRecords.php @@ -4,11 +4,14 @@ declare(strict_types=1); namespace App\Entity\Migration\Traits; +use Doctrine\DBAL\ArrayParameterType; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; use Doctrine\DBAL\ParameterType; -use Doctrine\DBAL\Types\Type; +/** + * @phpstan-type Param ParameterType|ArrayParameterType|string + */ trait UpdateAllRecords { /** @var Connection */ @@ -21,7 +24,7 @@ trait UpdateAllRecords * * @param string $table Table name * @param array $data Column-value pairs - * @param array|array $types Parameter types + * @param array $types Parameter types * * @return int|string The number of affected rows. * @@ -51,10 +54,12 @@ trait UpdateAllRecords /** * Extract ordered type list from an ordered column list and type map. * - * @param array $columnList - * @param array|array $types * - * @return array|array + * + * @param array $columnList + * @param array $types + * + * @return array */ private function extractTypeValues(array $columnList, array $types): array { diff --git a/src/Entity/Migration/Version20191101065730.php b/src/Entity/Migration/Version20191101065730.php index 3d610ce90..58d572c73 100644 --- a/src/Entity/Migration/Version20191101065730.php +++ b/src/Entity/Migration/Version20191101065730.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace App\Entity\Migration; +use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -use PDO; /** * Auto-generated Migration: Please modify to your needs! @@ -24,7 +24,7 @@ final class Version20191101065730 extends AbstractMigration $playlists = $this->connection->fetchAllAssociative( 'SELECT sp.* FROM station_playlists AS sp WHERE sp.type = ?', ['scheduled'], - [PDO::PARAM_STR] + [ParameterType::STRING] ); foreach ($playlists as $row) { diff --git a/src/Entity/Migration/Version20201027130504.php b/src/Entity/Migration/Version20201027130504.php index 2edf226d7..5f6bdbc3e 100644 --- a/src/Entity/Migration/Version20201027130504.php +++ b/src/Entity/Migration/Version20201027130504.php @@ -32,7 +32,7 @@ final class Version20201027130504 extends AbstractMigration ] ); - $storageLocationId = $this->connection->lastInsertId('storage_location'); + $storageLocationId = $this->connection->lastInsertId(); $this->connection->update( 'settings', [ @@ -81,7 +81,7 @@ final class Version20201027130504 extends AbstractMigration ] ); - $recordingsStorageLocationId = $this->connection->lastInsertId('storage_location'); + $recordingsStorageLocationId = $this->connection->lastInsertId(); $this->connection->update( 'station', @@ -111,7 +111,7 @@ final class Version20201027130504 extends AbstractMigration ] ); - $mediaStorageLocationId = $this->connection->lastInsertId('storage_location'); + $mediaStorageLocationId = $this->connection->lastInsertId(); foreach ($dirInfo['stations'] as $stationId) { $this->connection->update( diff --git a/src/Entity/Migration/Version20210512225946.php b/src/Entity/Migration/Version20210512225946.php index f46c23ee4..710928fc1 100644 --- a/src/Entity/Migration/Version20210512225946.php +++ b/src/Entity/Migration/Version20210512225946.php @@ -74,7 +74,7 @@ final class Version20210512225946 extends AbstractMigration ] ); - $podcastsStorageLocationId = $this->connection->lastInsertId('storage_location'); + $podcastsStorageLocationId = $this->connection->lastInsertId(); $this->connection->update( 'station', diff --git a/src/Entity/StorageLocation.php b/src/Entity/StorageLocation.php index 02dee80ae..f690fab9d 100644 --- a/src/Entity/StorageLocation.php +++ b/src/Entity/StorageLocation.php @@ -91,11 +91,11 @@ class StorageLocation implements Stringable, IdentifiableEntityInterface protected ?string $sftpPrivateKeyPassPhrase = null; #[ORM\Column(name: 'storage_quota', type: 'bigint', nullable: true)] - protected ?string $storageQuota = null; + protected string|int|null $storageQuota = null; #[ORM\Column(name: 'storage_used', type: 'bigint', nullable: true)] #[Attributes\AuditIgnore] - protected ?string $storageUsed = null; + protected string|int|null $storageUsed = null; /** @var Collection */ #[ORM\OneToMany(mappedBy: 'storage_location', targetEntity: StationMedia::class)] diff --git a/src/Normalizer/DoctrineEntityNormalizer.php b/src/Normalizer/DoctrineEntityNormalizer.php index 2b1aeec1f..91202ac31 100644 --- a/src/Normalizer/DoctrineEntityNormalizer.php +++ b/src/Normalizer/DoctrineEntityNormalizer.php @@ -7,9 +7,9 @@ use App\Normalizer\Attributes\DeepNormalize; use App\Normalizer\Exception\NoGetterAvailableException; use ArrayObject; use Doctrine\Common\Collections\Collection; -use Doctrine\Common\Util\ClassUtils; use Doctrine\Inflector\Inflector; use Doctrine\Inflector\InflectorFactory; +use Doctrine\ORM\Proxy\DefaultProxyClassNameResolver; use InvalidArgumentException; use ReflectionClass; use ReflectionException; @@ -21,8 +21,8 @@ use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; final class DoctrineEntityNormalizer extends AbstractObjectNormalizer { - private const CLASS_METADATA = 'class_metadata'; - private const ASSOCIATION_MAPPINGS = 'association_mappings'; + private const string CLASS_METADATA = 'class_metadata'; + private const string ASSOCIATION_MAPPINGS = 'association_mappings'; private readonly Inflector $inflector; @@ -375,7 +375,7 @@ final class DoctrineEntityNormalizer extends AbstractObjectNormalizer private function isEntity(mixed $class): bool { if (is_object($class)) { - $class = ClassUtils::getClass($class); + $class = DefaultProxyClassNameResolver::getClass($class); } if (!is_string($class) || !class_exists($class)) {