symfony / orm-pack

A Symfony Pack for Doctrine ORM
MIT License
1.82k stars 18 forks source link

Upgrade of DoctrineMigrationsBundle from 2.1.x to 3.0 leads to InvalidConfigurationException #24

Closed k00ni closed 4 years ago

k00ni commented 4 years ago

I just found about the unpack command. There was a misunderstanding on my side, because you want the versions to be non-restricted. My bad.


Because orm-pack makes no restrictions in the versions for each package, it loads the latest stable. Unfortunately there were breaking changes between DoctrineMigrationsBundle 2.2.x and 3.0. These changes are related to an "incomplete" config file which raises an InvalidConfigurationException.

I assume i just have to update that config file. But maybe that points to the question if its necessary to introduce version restrictions to orm-package libs?

Ref:


My setup is:

and i ran composer update.

Output was:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"

Prefetching 6 packages 🎶 💨
  - Downloading (100%)

Package operations: 0 installs, 6 updates, 0 removals
  - Updating symfony/flex (v1.7.1 => v1.8.2): Loading from cache
  - Updating jaybizzle/crawler-detect (v1.2.95 => v1.2.96): Loading from cache
  - Updating sensio/framework-extra-bundle (v5.5.5 => v5.5.6): Loading from cache
  - Updating symfony/string (v5.1.1 => v5.1.2): Loading from cache
  - Updating doctrine/migrations (2.2.1 => 3.0.0): Loading from cache
  - Updating doctrine/doctrine-migrations-bundle (2.1.2 => 3.0.1): Loading from cache
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.

Afterwards running any commands results in the following exceptions:

PHP Fatal error:  Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized options "dir_name, namespace" under "doctrine_migrations". Available options are "all_or_nothing", "check_database_platform", "connection", "custom_template", "em", "factories", "migrations", "migrations_paths", "organize_migrations", "services", "storage". in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php:327
Stack trace:
#0 /var/www/html/vendor/symfony/config/Definition/BaseNode.php(382): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
#1 /var/www/html/vendor/symfony/config/Definition/Processor.php(34): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
#2 /var/www/html/vendor/symfony/config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
#3 /var/www/html/vendor/symfony/dependency-injection/Extension/Extension.php(113): Symfony\Component\Config\Definition\Processor-> in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php on line 327

Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized options "dir_name, namespace" under "doctrine_migrations". Available options are "all_or_nothing", "check_database_platform", "connection", "custom_template", "em", "factories", "migrations", "migrations_paths", "organize_migrations", "services", "storage". in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php:327
Stack trace:
#0 /var/www/html/vendor/symfony/config/Definition/BaseNode.php(382): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
#1 /var/www/html/vendor/symfony/config/Definition/Processor.php(34): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
#2 /var/www/html/vendor/symfony/config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
#3 /var/www/html/vendor/symfony/dependency-injection/Extension/Extension.php(113): Symfony\Component\Config\Definition\Processor-> in /var/www/html/vendor/symfony/config/Definition/ArrayNode.php on line 327

My doctrine_migrations.yml looks like:

doctrine_migrations:
    dir_name: '%kernel.project_dir%/src/DoctrineMigrations'
    # namespace is arbitrary but should be different from App\Migrations
    # as migrations classes should NOT be autoloaded
    namespace: DoctrineMigrations

Part of my composer.json:

{
    "require": {
        "php": "^7.3",
        "ext-iconv": "*",
        "erusev/parsedown": "^1.7.3",
        "genkgo/mail": "^2.6.1",
        "jaybizzle/crawler-detect": "^1.2.84",
        "league/iso3166": "^2.1.4",
        "php-curl-class/php-curl-class": "^8.6",
        "sensio/framework-extra-bundle": "^5.5.1",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "4.4.*",
        "symfony/cache": "4.4.*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.7.1",
        "symfony/form": "4.4.*",
        "symfony/framework-bundle": "4.4.*",
        "symfony/monolog-bundle": "^3.5.0",
        "symfony/orm-pack": "^1.0.8",
        "symfony/polyfill-php80": "^1.14",
        "symfony/property-access": "4.4.*",
        "symfony/proxy-manager-bridge": "4.4.*",
        "symfony/security-bundle": "4.4.*",
        "symfony/serializer": "4.4.*",
        "symfony/twig-bridge": "4.4.*",
        "symfony/twig-bundle": "4.4.*",
        "symfony/validator": "4.4.*",
        "symfony/yaml": "4.4.*",
        "twig/twig": "^3.0.3"
    },
    "require-dev": {
        "friendsofphp/php-cs-fixer": "^2.16.3",
        "phpstan/phpstan": "^0.11.15",
        "symfony/filesystem": "4.4.*",
        "symfony/maker-bundle": "^1.19",
        "symfony/phpunit-bridge": "4.4.*",
        "symfony/polyfill-php80": "^1.15.0",
        "symfony/web-profiler-bundle": "4.4.*",
        "symplify/easy-coding-standard": "^6.1"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.4.*"
        }
    },
    "autoload": {
        "files": [
            "src/functions.php"
        ],
        "psr-4": {
            "App\\": "src/App/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "test/",
            "App\\Tests\\": "tests/"
        }
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        }
    }
}
k00ni commented 4 years ago

I just found about the unpack command. There was a misunderstanding on my side, because you want the versions to be non-restricted. My bad.

Ref: