In a Symfony 5.3 application I'm using the orm-pack and when checking the outdated dependencies with composer outdated I see that doctrine/dbal has a new version but I can not upgrade it because it's defined in the ORM Pack.
$ > composer outdated
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
doctrine/dbal 2.13.2 3.1.1 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
Is there any way to use the new package version the orm pack?
Here's my require part of the composer JSON file:
"require": {
"php": "^8.0.09",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"friendsofsymfony/rest-bundle": "^3.0",
"jms/serializer-bundle": "^3.10",
"nelmio/api-doc-bundle": "^4.4",
"symfony/console": "5.3.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.3.*",
"symfony/http-kernel": "5.3.*",
"symfony/messenger": "5.3.*",
"symfony/monolog-bundle": "^3.5",
"symfony/orm-pack": "^2.1",
"symfony/property-info": "5.3.*",
"symfony/runtime": "5.3.*",
"symfony/translation": "5.3.*",
"symfony/validator": "5.3.*",
"symfony/yaml": "5.3.*"
},
"require-dev": {
"behat/mink": "dev-master",
"friends-of-behat/mink-browserkit-driver": "^1.5",
"friends-of-behat/mink-extension": "2.5",
"friends-of-behat/symfony-extension": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12.94",
"phpstan/phpstan-doctrine": "^0.12.42",
"phpstan/phpstan-phpunit": "^0.12.21",
"phpunit/phpunit": "^9"
},
Looks like you installed the
orm-packunder an old version of Symfony Flex.Nowadays, when you
requirea pack you'd get something like this:Now Flex automatically "unpacks" the pack into the distinct dependencies provided by the pack, so you can manage those directly.
Since this didn't happen for you, now you need to:
Make sure you have a current version of Symfony Flex (e.g. 1.13.4, the latest as of today).
"Unpack" the pack by running:
This will remove the
orm-packdependency, and replace it with the dependencies the pack provides. Once that is done, you'd be able to manage the dependencies independently, because those will be listed on yourcomposer.jsonfile instead ofsymfony/orm-pack.Regarding the specific case of
doctrine/dbal, as of today:Note that
doctrine/dbalwill not be a direct dependency of your project in any case, but a dependency of the packages provided by theorm-pack. Since some of those dependencies are still locked to version ^2, you won't be able to update to 3 just yet.E.g., for the packages provided by the
orm-pack:So you'll notice that only the
doctrine-bundledeclares to be ready for DBAL 3. With unpacking the dependencies you will at least be able to manage them directly, which is much better, but you won't be able to jump to DBAL 3 yet. You will at a later date, and this part of the answer will become obsolete then.