sonata-project / SonataDoctrineORMAdminBundle

Integrate Doctrine ORM into the SonataAdminBundle
https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle
MIT License
445 stars 344 forks source link

Batch actions not working when using Symfony Ulid as identifier for entity #1604

Closed michealmouner closed 2 years ago

michealmouner commented 2 years ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' sonata-project/admin-bundle 3.105.0 4.5.1 The missing Symfony Admin Generator sonata-project/block-bundle 3.23.2 4.9.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library sonata-project/cache-bundle 3.3.0 3.4.0 This bundle provides caching services sonata-project/classification-bundle 3.16.0 3.18.0 Symfony SonataClassificationBundle sonata-project/datagrid-bundle 3.3.0 3.5.0 Symfony SonataDatagridBundle sonata-project/doctrine-extensions 1.13.1 1.16.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 3.35.0 4.2.1 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/entity-audit-bundle 1.4.0 v2.0.0 Audit for Doctrine Entities sonata-project/exporter 2.7.0 2.9.1 Lightweight Exporter library sonata-project/form-extensions 1.9.0 1.12.4 Symfony form extensions sonata-project/formatter-bundle 4.5.0 4.6.1 Symfony SonataFormatterBundle sonata-project/media-bundle 3.32.0 3.37.1 Symfony SonataMediaBundle sonata-project/notification-bundle 3.13.0 3.13.0 Symfony SonataNotificationBundle sonata-project/page-bundle 3.23.0 3.25.0 This bundle provides a Site and Page management through container and block services sonata-project/seo-bundle 2.13.1 3.0.0 Symfony SonataSeoBundle sonata-project/twig-extensions 1.8.0 1.9.1 Sonata twig extensions ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' symfony/amqp-messenger v5.4.0 v6.0.1 Symfony AMQP extension Messenger Bridge symfony/asset v5.2.12 v6.0.1 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/browser-kit v5.4.0 v6.0.1 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/cache v5.3.12 v6.0.1 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v2.5.0 v3.0.0 Generic abstractions related to caching symfony/config v4.4.34 v6.0.0 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console v4.4.34 v6.0.1 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.4.0 v6.0.1 Converts CSS selectors to XPath expressions symfony/debug v4.4.31 v4.4.31 Provides tools to ease debugging PHP code symfony/dependency-injection v4.4.34 v6.0.1 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts v2.5.0 v3.0.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v4.4.34 v6.0.1 Provides integration for Doctrine with various Symfony components symfony/doctrine-messenger v5.4.0 v6.0.1 Symfony Doctrine Messenger Bridge symfony/dom-crawler v5.4.0 v6.0.1 Eases DOM navigation for HTML and XML documents symfony/dotenv v5.4.0 v6.0.1 Registers environment variables from a .env file symfony/error-handler v4.4.34 v6.0.1 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v4.4.34 v6.0.1 Provides tools that allow your application components to communicate with each other by dispatching events and listening to... symfony/event-dispatcher-contracts v1.1.11 v3.0.0 Generic abstractions related to dispatching event symfony/expression-language v5.4.0 v6.0.1 Provides an engine that can compile and evaluate expressions symfony/filesystem v5.4.0 v6.0.0 Provides basic utilities for the filesystem symfony/finder v5.4.0 v6.0.0 Finds files and directories via an intuitive fluent interface symfony/flex v1.17.6 v2.0.1 Composer plugin for Symfony symfony/form v4.4.34 v6.0.1 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v4.4.34 v6.0.1 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client v5.4.0 v6.0.1 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v2.5.0 v3.0.0 Generic abstractions related to HTTP clients symfony/http-foundation v4.4.34 v6.0.1 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v4.4.35 v6.0.1 Provides a structured process for converting a Request into a Response symfony/intl v5.4.0 v6.0.1 Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library symfony/lock v5.4.0 v6.0.1 Creates and manages locks, a mechanism to provide exclusive access to a shared resource symfony/mailchimp-mailer v5.4.0 v6.0.0 Symfony Mailchimp Mailer Bridge symfony/mailer v5.4.0 v6.0.1 Helps sending emails symfony/maker-bundle v1.36.4 v1.36.4 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing bo... symfony/messenger v5.4.0 v6.0.1 Helps applications send and receive messages to/from other applications or via message queues symfony/mime v5.4.0 v6.0.1 Allows manipulating MIME messages symfony/monolog-bridge v5.2.12 v6.0.1 Provides integration for Monolog with various Symfony components symfony/monolog-bundle v3.7.1 v3.7.1 Symfony MonologBundle symfony/notifier v5.2.12 v6.0.1 Sends notifications via one or more channels (email, SMS, ...) symfony/options-resolver v4.4.30 v6.0.0 Provides an improved replacement for the array_replace PHP function symfony/phpunit-bridge v5.4.0 v6.0.0 Provides utilities for PHPUnit, especially user deprecation notices management 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/polyfill-uuid v1.23.0 v1.23.0 Symfony polyfill for uuid functions symfony/process v4.4.35 v6.0.0 Executes commands in sub-processes symfony/property-access v5.4.0 v6.0.0 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info v5.4.0 v6.0.0 Extracts information about PHP class' properties using metadata of popular sources symfony/proxy-manager-bridge v4.4.34 v6.0.1 Provides integration for ProxyManager with various Symfony components symfony/psr-http-message-bridge v2.1.2 v2.1.2 PSR HTTP message bridge symfony/redis-messenger v5.4.0 v6.0.1 Symfony Redis extension Messenger Bridge symfony/routing v4.4.34 v6.0.1 Maps an HTTP request to a set of configuration variables symfony/security-acl v3.2.0 v3.2.0 Symfony Security Component - ACL (Access Control List) symfony/security-bundle v4.4.34 v6.0.1 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-core v4.4.34 v6.0.1 Symfony Security Component - Core Library symfony/security-csrf v5.2.12 v6.0.1 Symfony Security Component - CSRF Library symfony/security-guard v4.4.27 v5.4.0 Symfony Security Component - Guard symfony/security-http v4.4.34 v6.0.1 Symfony Security Component - HTTP Integration symfony/serializer v5.4.0 v6.0.1 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like... symfony/service-contracts v2.5.0 v3.0.0 Generic abstractions related to writing services symfony/stopwatch v5.4.0 v6.0.0 Provides a way to profile code symfony/string v5.4.0 v6.0.1 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/templating v4.4.30 v6.0.1 Provides all the tools needed to build any kind of template system symfony/translation v4.4.34 v6.0.1 Provides tools to internationalize your application symfony/translation-contracts v2.5.0 v3.0.0 Generic abstractions related to translation symfony/twig-bridge v4.4.34 v6.0.1 Provides integration for Twig with various Symfony components symfony/twig-bundle v4.4.30 v6.0.1 Provides a tight integration of Twig into the Symfony full-stack framework symfony/uid v5.4.0 v6.0.1 Provides an object-oriented API to generate and represent UIDs symfony/validator v4.4.35 v6.0.1 Provides tools to validate values symfony/var-dumper v5.4.0 v6.0.1 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v5.4.0 v6.0.0 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-profiler-bundle v4.4.31 v6.0.1 Provides a development tool that gives detailed information about the execution of any request symfony/webpack-encore-bundle v1.13.1 v1.13.2 Integration with your Symfony app & Webpack Encore! symfony/workflow v5.4.0 v6.0.1 Provides tools for managing a workflow or finite state machine symfony/yaml v5.3.11 v6.0.1 Loads and dumps YAML files ```

PHP version

$ php -v
PHP 8.0.11 (cli) (built: Sep 26 2021 20:58:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
    with Xdebug v3.1.0, Copyright (c) 2002-2021, by Derick Rethans

Subject

context: batch delete action for entity with Symfony\Component\Uid\Ulid as identifier

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Ulid;

/**
 * @ORM\Table(name="table_name")
 * @ORM\Entity
 */
class ClassName
{
    /**
     * @ORM\Id
     * @ORM\Column(type="ulid")
     */
    private Ulid $id;

   .....
}

Minimal repository with the bug

reference line from latest version seems not fixed too 🤞 https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/4.x/src/Model/ModelManager.php#L320

query parameters should be binary not string in this case

ex: Ulid::fromString($ulidString)->toBinary()

Steps to reproduce

Expected results

Actual results

VincentLanglet commented 2 years ago

I would say we cannot consider this as a bug since UUID (and certainly Ulid) are not considered as supported currently by SonataAdmin. See https://github.com/sonata-project/SonataAdminBundle/issues/7327.

But any contribution is welcomed.

VincentLanglet commented 2 years ago

I'll close this in favor of https://github.com/sonata-project/SonataAdminBundle/issues/7327