Closed 7ochem closed 3 years ago
In my suggested solution, it should be "not hasRoute ('batch')" of course: if (!$this->hasRoute('batch')) {
(updated the description with this).
Make sens, can you open a PR for this @77web ? :) A screenshot before/after could be great
maybe @7ochem ? :grin:
maybe @7ochem ? 😁
I chose you to do the PR 😆
Sorry, I indeed mess up with the autocomplete.
On it 👍🏻
Environment
Both:
And:
Sonata packages
show
``` sonata-project/admin-bundle 4.0.1 4.0.1 The missing Symfony Admin Generator sonata-project/block-bundle 4.7.0 4.7.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library sonata-project/doctrine-extensions 1.14.0 1.14.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.0.0 4.0.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.8.0 2.8.0 Lightweight Exporter library sonata-project/form-extensions 1.11.0 1.11.0 Symfony form extensions sonata-project/twig-extensions 1.9.0 1.9.0 Sonata twig extensions ```
Symfony packages
show
``` symfony/asset 5.4.x-dev 1a482ad 5.4.x-dev 1a482ad Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/browser-kit 5.4.x-dev a8e3e66 5.4.x-dev a8e3e66 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/cache 5.4.x-dev ccf2fb6 5.4.x-dev ccf2fb6 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v2.4.0 v2.4.0 Generic abstractions related to caching symfony/config 5.4.x-dev a58210c 5.4.x-dev a58210c Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console 5.4.x-dev 6b71e16 5.4.x-dev 6b71e16 Eases the creation of beautiful and testable command line interfaces symfony/css-selector 5.4.x-dev 44b933f 5.4.x-dev 44b933f Converts CSS selectors to XPath expressions symfony/debug-bundle 5.4.x-dev 71c299d 5.4.x-dev 71c299d Provides a tight integration of the Symfony Debug component into the Symfony full-stack framework symfony/dependency-injection 5.4.x-dev f84ead2 5.4.x-dev f84ead2 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts v2.4.0 v2.4.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge 5.4.x-dev 6baa5f9 5.4.x-dev 6baa5f9 Provides integration for Doctrine with various Symfony components symfony/dom-crawler 5.4.x-dev 98c4a5a 5.4.x-dev 98c4a5a Eases DOM navigation for HTML and XML documents symfony/dotenv 5.4.x-dev 71aafac 5.4.x-dev 71aafac Registers environment variables from a .env file symfony/error-handler 5.4.x-dev 91eb974 5.4.x-dev 91eb974 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher 5.4.x-dev ac2f062 5.4.x-dev ac2f062 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v2.4.0 v2.4.0 Generic abstractions related to dispatching event symfony/expression-language 5.4.x-dev 8e47a1a 5.4.x-dev 8e47a1a Provides an engine that can compile and evaluate expressions symfony/filesystem 5.4.x-dev d685d0c 5.4.x-dev d685d0c Provides basic utilities for the filesystem symfony/finder 5.4.x-dev 3d70c86 5.4.x-dev 3d70c86 Finds files and directories via an intuitive fluent interface symfony/flex v1.16.3 v1.16.3 Composer plugin for Symfony symfony/form 5.4.x-dev 5b431a5 5.4.x-dev 5b431a5 Allows to easily create, process and reuse HTML forms symfony/framework-bundle 5.4.x-dev c8f18ee 5.4.x-dev c8f18ee Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client 5.4.x-dev c2bdad5 5.4.x-dev c2bdad5 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v2.4.0 v2.4.0 Generic abstractions related to HTTP clients symfony/http-foundation 5.4.x-dev 2561c6b 5.4.x-dev 2561c6b Defines an object-oriented layer for the HTTP specification symfony/http-kernel 5.4.x-dev 388ef4a 5.4.x-dev 388ef4a Provides a structured process for converting a Request into a Response symfony/intl 5.4.x-dev 68e5c6f 5.4.x-dev 68e5c6f Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library symfony/mailer 5.4.x-dev 01d8181 5.4.x-dev 01d8181 Helps sending emails symfony/maker-bundle v1.34.0 v1.34.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerpl... symfony/mime 5.4.x-dev 17f3a3d 5.4.x-dev 17f3a3d Allows manipulating MIME messages symfony/monolog-bridge 5.4.x-dev 60ec9df 5.4.x-dev 60ec9df Provides integration for Monolog with various Symfony components symfony/monolog-bundle v3.7.0 v3.7.0 Symfony MonologBundle symfony/notifier 5.4.x-dev 97d56e9 5.4.x-dev 97d56e9 Sends notifications via one or more channels (email, SMS, ...) symfony/options-resolver 5.4.x-dev cd63dba 5.4.x-dev cd63dba Provides an improved replacement for the array_replace PHP function symfony/password-hasher 5.4.x-dev 0f2ca6e 5.4.x-dev 0f2ca6e Provides password hashing utilities symfony/phpunit-bridge v5.3.8 v5.3.8 Provides utilities for PHPUnit, especially user deprecation notices management symfony/polyfill-intl-grapheme v1.23.1 v1.23.1 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.23.0 v1.23.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn v1.23.0 v1.23.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.23.0 v1.23.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.23.1 v1.23.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php73 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.23.1 v1.23.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/process 5.4.x-dev b076aa9 5.4.x-dev b076aa9 Executes commands in sub-processes symfony/property-access 5.4.x-dev bd3efa2 5.4.x-dev bd3efa2 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info 5.4.x-dev 5055028 5.4.x-dev 5055028 Extracts information about PHP class' properties using metadata of popular sources symfony/proxy-manager-bridge 5.4.x-dev 497e278 5.4.x-dev 497e278 Provides integration for ProxyManager with various Symfony components symfony/routing 5.4.x-dev 5a54b92 5.4.x-dev 5a54b92 Maps an HTTP request to a set of configuration variables symfony/runtime 5.4.x-dev 56b3b0c 5.4.x-dev 56b3b0c Enables decoupling PHP applications from global state symfony/security-acl v3.2.0 v3.2.0 Symfony Security Component - ACL (Access Control List) symfony/security-bundle 5.4.x-dev 5f8f939 5.4.x-dev 5f8f939 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-core 5.4.x-dev e52ddfc 5.4.x-dev e52ddfc Symfony Security Component - Core Library symfony/security-csrf 5.4.x-dev 06c10c6 5.4.x-dev 06c10c6 Symfony Security Component - CSRF Library symfony/security-guard 5.4.x-dev 1e16f8b 6.0.x-dev b92b7ee Symfony Security Component - Guard symfony/security-http 5.4.x-dev 91c14f2 5.4.x-dev 91c14f2 Symfony Security Component - HTTP Integration symfony/serializer 5.4.x-dev 8052a39 5.4.x-dev 8052a39 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML a... symfony/service-contracts v2.4.0 v2.4.0 Generic abstractions related to writing services symfony/stopwatch 5.4.x-dev 68e61ec 5.4.x-dev 68e61ec Provides a way to profile code symfony/string 5.4.x-dev 412eda2 5.4.x-dev 412eda2 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation 5.4.x-dev 1eb75b7 5.4.x-dev 1eb75b7 Provides tools to internationalize your application symfony/translation-contracts v2.4.0 v2.4.0 Generic abstractions related to translation symfony/twig-bridge 5.4.x-dev b33c743 5.4.x-dev b33c743 Provides integration for Twig with various Symfony components symfony/twig-bundle 5.4.x-dev 242b684 5.4.x-dev 242b684 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator 5.4.x-dev e5b271c 5.4.x-dev e5b271c Provides tools to validate values symfony/var-dumper 5.4.x-dev a60e015 5.4.x-dev a60e015 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter 5.4.x-dev b6e4ed5 5.4.x-dev b6e4ed5 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-link 5.4.x-dev de535b4 5.4.x-dev de535b4 Manages links between resources symfony/web-profiler-bundle 5.4.x-dev aa1e2ac 5.4.x-dev aa1e2ac Provides a development tool that gives detailed information about the execution of any request symfony/yaml 5.4.x-dev 251888d 5.4.x-dev 251888d Loads and dumps YAML files ```
PHP version
PHP 7.4.13
``` PHP 7.4.13 (cli) (built: Dec 1 2020 04:25:48) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans ```
Subject
If I remove the
'batch'
route inconfigureRoutes()
to disable batch processing in my specific admin, then the list screen still shows a "batch" column, but no batch actions.The
\Sonata\AdminBundle\Admin\AbstractAdmin::getBatchActions()
is adding a'delete'
batch action and for this it is checking if the'delete'
route exists. So the number of returned batch actions is > 0 and the list view will show a batch column.Minimal repository with the bug
N.a.
Steps to reproduce
Expected results
I expect any batch related columns, info and buttons to be gone.
Actual results
The batch actions block is gone, but the batch column with checkboxes is still there
Solution
Should
\Sonata\AdminBundle\Admin\AbstractAdmin::getBatchActions()
also check for the'batch'
route?https://github.com/sonata-project/SonataAdminBundle/blob/629f215596eb6c3b8189e6e562db20c4b2df6efe/src/Admin/AbstractAdmin.php#L747-L757