-1

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"
        },
yivi
  • 42,438
  • 18
  • 116
  • 138
petekaner
  • 8,071
  • 5
  • 29
  • 52
  • 1
    Short answer is no. The Doctrine ORM does not yet run under DBAL 3. Just need to wait patiently for ORM 3 to be released and everything updated. The reason DBAL 3 shows up is that you could use the library without using the ORM (or the Symfony Doctrine bundle). Note that even with a completely fresh 5.3 install you still get the same yellow version notice. – Cerad Aug 16 '21 at 13:27

2 Answers2

1

Looks like you installed the orm-pack under an old version of Symfony Flex.

Nowadays, when you require a pack you'd get something like this:

[...]
Unpacked symfony/profiler-pack dependencies
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 0 updates, 1 removal
  - Removing symfony/profiler-pack (v1.0.5)

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:

    composer unpack orm-pack
    

This will remove the orm-pack dependency, 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 your composer.json file instead of symfony/orm-pack.


Regarding the specific case of doctrine/dbal, as of today:

Note that doctrine/dbal will not be a direct dependency of your project in any case, but a dependency of the packages provided by the orm-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:

Package dbal versions required
doctrine/doctrine-bundle ^2.9.0|^3.0
doctrine/orm ^2.13.0
doctrine/doctrine-migrations-bundle ^2.11 (via doctrine-migrations)

So you'll notice that only the doctrine-bundle declares 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.

yivi
  • 42,438
  • 18
  • 116
  • 138
1

There are tons of packages that are not ready yet for doctrine/dbal v3. For example, symfony/orm-pack requires doctrine/migrations (in any version), and there is currently no version of doctrine/migrations that is compatible with the new DBAL branch.

So: even if you unpacked the ORM pack, you still cannot upgrade DBAL to v3.

Nico Haase
  • 11,420
  • 35
  • 43
  • 69
  • I see, so there's no way have this package updated when using migratios. It's a pain in the ass cause we have a composer outdated check in our pipelines – petekaner Aug 16 '21 at 08:29
  • 1
    That check is definitely interesting in terms of "could I upgrade packages", but probably it should not block the pipelines? – Nico Haase Aug 16 '21 at 08:33
  • 1
    Composer has two categories of dependency notification. Red dependencies are dependencies that should be installed. Yellow dependencies are upgrades that are available but need not be installed. DBAL 3 is a yellow dependency. Your pipeline check should be configured to ignore yellow dependencies. – Cerad Aug 16 '21 at 13:32