sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Tagging as sonata.admin.extension with target and priority fails #8000

Closed HeldVomErdbeerfeld closed 1 year ago

HeldVomErdbeerfeld commented 1 year ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' sonata-project/admin-bundle 4.22.1 4.22.1 The missing Symfony Admin Generator sonata-project/block-bundle 4.19.0 4.19.0 Symfony SonataBlockBundle sonata-project/doctrine-extensions 2.1.0 2.1.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.9.1 4.9.1 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 3.1.1 3.1.1 Lightweight Exporter library sonata-project/form-extensions 1.18.0 1.18.0 Symfony form extensions sonata-project/translation-bundle 3.1.0 3.1.0 SonataTranslationBundle sonata-project/twig-extensions 2.0.0 2.0.0 Sonata twig extensions sonata-project/user-bundle 5.4.0 5.4.0 Symfony SonataUserBundle ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' symfony/framework-bundle v5.4.17 ~ v6.2.3 Provides a tight integration between Symfony components ... ... ```

PHP version

$ php -v
PHP 8.1.13 (cli) (built: Nov 26 2022 14:27:02) (NTS)

Subject

ExtensionCompilerPass.php fails since #7964 Affected versions: 4.22.0 and 4.22.1

Steps to reproduce

    # following example works
    App\Admin\TestAdminExtension:
        tags:
            - { name: sonata.admin.extension, target: 'App\Admin\TestAdmin' }
    # following example FAILS
    App\Admin\TestAdminExtension:
        tags:
            - { name: sonata.admin.extension, target: 'App\Admin\TestAdmin', priority: 10 }

Expected results

Expecting warming cache is working

Actual results

2023-01-05T12:58:04+00:00 [critical] Uncaught Error: 
Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass::shouldApplyExtension(): Argument #2 ($subject) must be of type string, int given, called in /var/www/html/vendor/sonata-project/admin-bundle/src/DependencyInjection/Compiler/ExtensionCompilerPass.php on line 149
VincentLanglet commented 1 year ago

Hi thanks for the report, can you try https://github.com/sonata-project/SonataAdminBundle/pull/8001 ?

BA-JBI commented 1 year ago

Thanks @VincentLanglet Yes #8001 solves the problem!

error has gone and priority is respected correctly!

HeldVomErdbeerfeld commented 1 year ago

Confirm! Problem is solved.

I hope closing this issue is okay?! or shoud i wait until merge request is applied?