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

After rendering the filter form the choice names are not displayed. #4755

Closed fadoe closed 4 years ago

fadoe commented 6 years ago

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.24.0                                3.24.0                                The missing Symfony Admin Generator
sonata-project/block-bundle              3.4.0                                 3.5.0                                 Symfony SonataBlockBundle
sonata-project/cache                     1.1.0                                 2.0.0                                 Cache library
sonata-project/core-bundle               3.5.1                                 3.6.0                                 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2.1                                 2.2.1                                 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2                                 1.0.2                                 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.1.7                                 3.1.7                                 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.2.0                                 2.2.0                                 Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.7.1                                 1.7.1                                 Lightweight Exporter library
sonata-project/formatter-bundle          3.3.0                                 3.3.0                                 Symfony SonataFormatterBundle
sonata-project/google-authenticator      1.1.0                                 2.0.0                                 Library to integrate Google Authenticator into a PHP project
sonata-project/media-bundle              3.8.0                                 3.8.0                                 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.2.0                                 3.2.0                                 Symfony SonataNotificationBundle
sonata-project/user-bundle               dev-add_support_for_fos_user2 99be909 dev-add_support_for_fos_user2 99be909 Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/monolog-bundle     v3.1.1  v3.1.2  Symfony MonologBundle 
symfony/phpunit-bridge     v3.3.10 v3.3.10 Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.6.0  v1.6.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu  v1.6.0  v1.6.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.6.0  v1.6.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.6.0  v1.6.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.6.0  v1.6.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.6.0  v1.6.0  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v3.1.5  v3.1.6  Symfony SwiftmailerBundle
symfony/symfony            v3.3.10 v3.3.10 The Symfony PHP framework

PHP version

$ php -v
PHP 7.1.9-1+ubuntu17.04.1+deb.sury.org+1 (cli) (built: Sep  2 2017 05:57:15) ( NTS )

Subject

The filter form renders the choice type not correct.

Steps to reproduce

To filter a list I added a choice field to the filter:

    protected function configureDatagridFilters(DatagridMapper $filter)
    {
        // $myChoices = collection of ChoiceEntity()

        $filter
            ->add(
                'mychoice',
                'doctrine_orm_callback',
                [
                    'callback' => [$filterCallback, 'filterChoice'],
                    'field_type' => 'choice',
                    'field_options' => [
                        'choices' => $myChoices,
                        'choice_name' => function (ChoiceEntity $choice = null, $key, $index) {
                            return $choice ? $choice->getName() : '';
                        },
                    ]
                ],
                'choice'
            ):
    //...
    }

Expected results

When I drop out the choice I see the name from my ChoiceEntity.

Actual results

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.