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

Disabled option does not disable editing #6130

Closed ZeinCube closed 3 years ago

ZeinCube commented 4 years ago

Environment

MacOs Catalina 10.15.2

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.52.0 3.63.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.17.0 3.19.0 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.17.0 3.17.2 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  2.5.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.3.0  1.6.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.10.0 3.15.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.11.1 1.11.1 Lightweight Exporter library
sonata-project/intl-bundle               2.7.0  2.7.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.20.1 3.24.0 Symfony SonataMediaBundle
sonata-project/user-bundle               4.4.0  4.5.3  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/http-client           v4.3.3  v4.4.9  Symfony HttpClient component
symfony/http-client-contracts v1.1.5  v1.1.8  Generic abstractions related to HTTP clients
symfony/mime                  v4.3.3  v4.4.9  A library to manipulate MIME messages
symfony/monolog-bundle        v3.4.0  v3.5.0  Symfony MonologBundle
symfony/phpunit-bridge        v3.4.30 v5.1.0  Symfony PHPUnit Bridge
symfony/polyfill-apcu         v1.12.0 v1.17.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype        v1.14.0 v1.17.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu     v1.12.0 v1.17.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn     v1.12.0 v1.17.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring     v1.14.0 v1.17.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56        v1.12.0 v1.17.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70        v1.12.0 v1.17.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72        v1.12.0 v1.17.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73        v1.12.0 v1.17.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-util         v1.12.0 v1.17.0 Symfony utilities for portability of PHP codes
symfony/security-acl          v3.0.2  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle    v2.6.7  v3.4.0  Symfony SwiftmailerBundle
symfony/symfony               v3.4.30 v4.4.9  The Symfony PHP framework

PHP version

$ php -v
PHP 7.2.28 (cli) (built: Feb 20 2020 10:35:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.28, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans

Subject

Code in admin referenced to main entity

->add(
                        'arrayCollection',
                        'sonata_type_collection',
                        [
                            'required'     => false,
                            'by_reference' => false,
                            'type_options' => [
                                'delete' => false,
                            ],
                            'btn_add' => false,
                        ],
                        [
                            'edit'   => 'inline',
                            'inline' => 'table',
                        ]
                    )

Code in admin of entity of ArrayCollection

$form
            ->add('choiceEntity', null, [
                'disabled' => true,
            ])
...

The admin of the main entity has a table for editing related entities, we denote it A. Entity A has an associated entity (B) this entity in the admin panel of A is represented by choiceType and has the option 'disabled' => true. However, when you click the left mouse button and press "enter", a drop-down menu appears with entities that can be changed, despite the fact that the field is disabled for editing

Expected results

The choiceType field should not have been editable.

Actual results

Field is able for edit bug_report

VincentLanglet commented 4 years ago

@ZeinCube I cannot reproduce the issue. Do you have a minimal repo with the issue ? Which browser do you use ?

You should first try the latest version of Sonata.

ZeinCube commented 4 years ago

Hi, @VincentLanglet A haven't repo with this issue, there are a lot of NDA code, but later I can publish example of it with latest version of Sonata. Also I will try to reproduce this bug with SF 4.4 What is your version of Sonata?

VincentLanglet commented 4 years ago

I'm currently using 3.69.*. I tried to click, to press enter, without having the bug. Do you have any error in the navigator console ? Which navigator do you use ?

later I can publish example of it with latest version of Sonata.

This will help.

VincentLanglet commented 3 years ago

Friendly ping @ZeinCube, did you have to publish an example ?