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

deleteAction does not do it #6046

Closed legalcash closed 3 years ago

legalcash commented 4 years ago

prod

$ composer show --latest 'sonata-project/*'
onata-project/admin-bundle              3.53.0 3.64.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.17.0 3.18.4 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.17.0 3.18.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.5.0  3.2.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.17.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                  2.0.1  2.2.0  Lightweight Exporter library
sonata-project/formatter-bundle          3.5.0  4.1.3  Symfony SonataFormatterBundle
sonata-project/google-authenticator      2.2.0  2.2.0  Library to integrate Google Authenticator into a PHP project
sonata-project/translation-bundle        2.4.2  2.5.0  SonataTranslationBundle
sonata-project/user-bundle               4.4.0  4.5.2  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/acl-bundle                 v1.0.0             v2.0.0             Symfony AclBundle
symfony/asset                      v4.3.4             v5.0.7             Symfony Asset Component
symfony/browser-kit                v4.3.4             v5.0.7             Symfony BrowserKit Component
symfony/cache                      v4.3.4             v5.0.7             Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v1.1.5             v2.0.1             Generic abstractions related to caching
symfony/config                     v4.3.4             v5.0.7             Symfony Config Component
symfony/console                    v4.3.4             v5.0.7             Symfony Console Component
symfony/css-selector               v4.3.4             v5.0.7             Symfony CssSelector Component
symfony/debug                      v4.3.4             v4.4.7             Symfony Debug Component
symfony/dependency-injection       v4.3.4             v5.0.7             Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.3.4             v5.0.7             Symfony Doctrine Bridge
symfony/dom-crawler                v4.3.4             v5.0.7             Symfony DomCrawler Component
symfony/dotenv                     v4.3.4             v5.0.7             Registers environment variables from a .env file
symfony/event-dispatcher           v4.3.4             v5.0.7             Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.5             v2.0.1             Generic abstractions related to dispatching event
symfony/expression-language        v4.3.4             v5.0.7             Symfony ExpressionLanguage Component
symfony/filesystem                 v4.3.4             v5.0.7             Symfony Filesystem Component
symfony/finder                     v4.3.4             v5.0.7             Symfony Finder Component
symfony/flex                       v1.4.5             v1.6.2             Composer plugin for Symfony
symfony/form                       v4.3.4             v5.0.7             Symfony Form Component
symfony/framework-bundle           v4.3.4             v5.0.7             Symfony FrameworkBundle
symfony/http-client                v4.3.4             v5.0.7             Symfony HttpClient component
symfony/http-client-contracts      v1.1.6             v2.0.1             Generic abstractions related to HTTP clients
symfony/http-foundation            v4.3.4             v5.0.7             Symfony HttpFoundation Component
symfony/http-kernel                v4.3.4             v5.0.7             Symfony HttpKernel Component
symfony/inflector                  v4.3.4             v5.0.7             Symfony Inflector Component
symfony/intl                       v4.3.4             v5.0.7             A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/lock                       v4.3.4             v5.0.7             Symfony Lock Component
symfony/lts                        dev-master c1affae dev-master c1affae Enforces Long Term Supported versions of Symfony components
Package symfony/lts is abandoned, you should avoid using it. Use symfony/flex instead.
symfony/maker-bundle               v1.13.0            v1.15.0            Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can...
symfony/messenger                  v4.3.4             v5.0.7             Symfony Messenger Component
symfony/mime                       v4.3.4             v5.0.7             A library to manipulate MIME messages
symfony/monolog-bridge             v4.3.4             v5.0.7             Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0             v3.5.0             Symfony MonologBundle
symfony/options-resolver           v4.3.4             v5.0.7             Symfony OptionsResolver Component
symfony/orm-pack                   v1.0.6             v1.0.8             A pack for the Doctrine ORM
symfony/phpunit-bridge             v4.3.4             v5.0.7             Symfony PHPUnit Bridge
symfony/polyfill-intl-icu          v1.12.0            v1.15.0            Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.12.0            v1.15.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.12.0            v1.15.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.12.0            v1.15.0            Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.12.0            v1.15.0            Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/process                    v4.3.4             v5.0.7             Symfony Process Component
symfony/profiler-pack              v1.0.4             v1.0.4             A pack for the Symfony web profiler
symfony/property-access            v4.3.4             v5.0.7             Symfony PropertyAccess Component
symfony/property-info              v4.3.4             v5.0.7             Symfony Property Info Component
symfony/proxy-manager-bridge       v4.4.1             v5.0.7             Symfony ProxyManager Bridge
symfony/routing                    v4.3.4             v5.0.7             Symfony Routing Component
symfony/security-acl               v3.0.2             v3.0.4             Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.3.4             v5.0.7             Symfony SecurityBundle
symfony/security-core              v4.3.4             v5.0.7             Symfony Security Component - Core Library
symfony/security-csrf              v4.3.4             v5.0.7             Symfony Security Component - CSRF Library
symfony/security-guard             v4.3.4             v5.0.7             Symfony Security Component - Guard
symfony/security-http              v4.3.4             v5.0.7             Symfony Security Component - HTTP Integration
symfony/serializer                 v4.3.4             v5.0.7             Symfony Serializer Component
symfony/serializer-pack            v1.0.2             v1.0.3             A pack for the Symfony serializer
symfony/service-contracts          v1.1.6             v2.0.1             Generic abstractions related to writing services
symfony/stopwatch                  v4.3.4             v5.0.7             Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.2.8             v3.4.0             Symfony SwiftmailerBundle
symfony/templating                 v4.3.4             v5.0.7             Symfony Templating Component
symfony/test-pack                  v1.0.6             v1.0.6             A pack for functional and end-to-end testing within a Symfony app
symfony/translation                v4.3.4             v5.0.7             Symfony Translation Component
symfony/translation-contracts      v1.1.6             v2.0.1             Generic abstractions related to translation
symfony/twig-bridge                v4.3.4             v5.0.7             Symfony Twig Bridge
symfony/twig-bundle                v4.3.4             v5.0.7             Symfony TwigBundle
symfony/validator                  v4.3.4             v5.0.7             Symfony Validator Component
symfony/var-dumper                 v4.3.4             v5.0.7             Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.3.4             v5.0.7             A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-link                   v4.3.4             v5.0.7             Symfony WebLink Component
symfony/web-profiler-bundle        v4.3.4             v5.0.7             Symfony WebProfilerBundle
symfony/web-server-bundle          v4.3.4             v4.4.7             Symfony WebServerBundle
symfony/webpack-encore-bundle      v1.6.2             v1.7.3             Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v4.3.4             v5.0.7             Symfony Yaml Component

PHP version

$ php -v
PHP 7.3.16 (cli) (built: Mar 17 2020 10:18:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.

Subject

clicking on delete action in list action show confirmation page. i click Yes, delete - and again confirmation page. I look inside and noticed that: in ./vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php method: always return $request->getMethod()

protected function getRestMethod()
    {
        $request = $this->getRequest();
        if (Request::getHttpMethodParameterOverride() || !$request->request->has('_method')) {
            return $request->getMethod();
        }

        return $request->request->get('_method');
    }

I think you need to make

...
if ( !Request::getHttpMethodParameterOverride()  ...
phansys commented 4 years ago

Seems that your proposed solution is the right one @legalcash. Do you mind to create a pull request?

Thank you!

wbloszyk commented 4 years ago

@legalcash I successful delete object. I use php 7.4 and:

sonata-project/admin-bundle              3.74.0          3.74.0             The missing Symfony Admin Generator
sonata-project/block-bundle              3.20.0          4.3.0              Symfony SonataBlockBundle
sonata-project/cache                     1.1.1           2.0.1              Cache library
sonata-project/cache-bundle              2.4.2           3.2.1              This bundle provides caching services
sonata-project/classification-bundle     3.12.1          3.13.1             Symfony SonataClassificationBundle
sonata-project/comment-bundle            3.2.0           3.2.0              Integrate the FOSCommentBundle in the Sonata Project
sonata-project/datagrid-bundle           2.5.0           3.2.0              Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.9.1           1.9.1              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.21.0          3.21.0             Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0           2.5.0              Symfony SonataEasyExtendsBundle
sonata-project/ecommerce                 3.3.0           3.3.0              E-Commerce solution provided by Sonata
sonata-project/exporter                  2.3.0           2.3.0              Lightweight Exporter library
sonata-project/form-extensions           1.6.0           1.6.0              Symfony form extensions
sonata-project/formatter-bundle          4.2.0           4.2.0              Symfony SonataFormatterBundle
sonata-project/google-authenticator      2.2.0           2.2.0              Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle               2.9.0           2.9.0              Symfony SonataIntlBundle
sonata-project/media-bundle              3.26.0          3.26.0             Symfony SonataMediaBundle
sonata-project/news-bundle               3.14.0          3.14.0             Symfony SonataNewsBundle
sonata-project/notification-bundle       3.9.0           3.9.0              Symfony SonataNotificationBundle
sonata-project/page-bundle               3.18.0          3.18.0             This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.11.0          2.11.0             Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.6.0           3.6.0              Integrates SpyTimelineBundle into Sonata
sonata-project/twig-extensions           1.x-dev f0bd7a0 dev-master 3531b27 Sonata twig extensions
sonata-project/user-bundle               4.7.0           4.7.0              Symfony SonataUserBundle

I think this issue is resolve. Can you update admin-bundle and check it again?