sonata-project / SonataClassificationBundle

Symfony SonataClassificationBundle
https://docs.sonata-project.org/projects/SonataClassificationBundle
MIT License
89 stars 115 forks source link

Invalid cascade mapping for doctrine/orm 3 #973

Open fbuchlak opened 2 weeks ago

fbuchlak commented 2 weeks ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' Direct dependencies required in composer.json: sonata-project/admin-bundle 4.31.0 4.31.0 The missing Symfony Admin Generator sonata-project/block-bundle 5.1.1 5.1.1 Symfony SonataBlockBundle sonata-project/classification-bundle 4.8.1 4.8.1 Symfony SonataClassificationBundle sonata-project/doctrine-orm-admin-bundle 4.17.1 4.17.1 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/form-extensions 2.4.0 2.4.0 Symfony form extensions sonata-project/formatter-bundle 5.4.1 5.4.1 Symfony SonataFormatterBundle sonata-project/intl-bundle 3.2.0 3.2.0 Symfony SonataIntlBundle sonata-project/media-bundle 4.14.1 4.14.1 Symfony SonataMediaBundle sonata-project/seo-bundle 3.8.0 3.8.0 Symfony SonataSeoBundle Transitive dependencies not required in composer.json: sonata-project/doctrine-extensions 2.4.1 2.4.1 Doctrine2 behavioral extensions sonata-project/exporter 3.3.0 3.3.0 Lightweight Exporter library sonata-project/twig-extensions 2.5.0 2.5.0 Sonata twig extensions ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' symfony/apache-pack 1.0.1 1.0.1 A pack for Apache support in Symfony symfony/asset 7.1.6 7.1.6 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/asset-mapper 7.1.6 7.1.6 Maps directories of assets & makes them available in a public directory with versioned filenames. symfony/browser-kit 7.1.6 7.1.6 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/console 7.1.6 7.1.6 Eases the creation of beautiful and testable command line interfaces symfony/css-selector 7.1.6 7.1.6 Converts CSS selectors to XPath expressions symfony/debug-bundle 7.1.6 7.1.6 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symf... symfony/doctrine-messenger 7.1.6 7.1.6 Symfony Doctrine Messenger Bridge symfony/dom-crawler 7.1.6 7.1.6 Eases DOM navigation for HTML and XML documents symfony/dotenv 7.1.6 7.1.6 Registers environment variables from a .env file symfony/filesystem 7.1.6 7.1.6 Provides basic utilities for the filesystem symfony/finder 7.1.6 7.1.6 Finds files and directories via an intuitive fluent interface symfony/flex 2.4.7 2.4.7 Composer plugin for Symfony symfony/form 7.1.6 7.1.6 Allows to easily create, process and reuse HTML forms symfony/framework-bundle 7.1.6 7.1.6 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/mailer 7.1.6 7.1.6 Helps sending emails symfony/maker-bundle 1.61.0 1.61.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing ... symfony/messenger 7.1.6 7.1.6 Helps applications send and receive messages to/from other applications or via message queues symfony/monolog-bundle 3.10.0 3.10.0 Symfony MonologBundle symfony/phpunit-bridge 7.1.6 7.1.6 Provides utilities for PHPUnit, especially user deprecation notices management symfony/rate-limiter 7.1.6 7.1.6 Provides a Token Bucket implementation to rate limit input and output in your application symfony/requirements-checker 2.0.1 2.0.1 Check Symfony requirements and give recommendations symfony/runtime 7.1.6 7.1.6 Enables decoupling PHP applications from global state symfony/security-bundle 7.1.6 7.1.6 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-csrf 7.1.6 7.1.6 Symfony Security Component - CSRF Library symfony/serializer 7.1.6 7.1.6 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats li... symfony/stimulus-bundle 2.21.0 2.21.0 Integration with your Symfony app & Stimulus! symfony/stopwatch 7.1.6 7.1.6 Provides a way to profile code symfony/string 7.1.6 7.1.6 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation 7.1.6 7.1.6 Provides tools to internationalize your application symfony/twig-bundle 7.1.6 7.1.6 Provides a tight integration of Twig into the Symfony full-stack framework symfony/uid 7.1.6 7.1.6 Provides an object-oriented API to generate and represent UIDs symfony/ux-autocomplete 2.21.0 2.21.0 JavaScript Autocomplete functionality for Symfony symfony/ux-icons 2.21.0 2.21.0 Renders local and remote SVG icons in your Twig templates. symfony/ux-leaflet-map 2.21.0 2.21.0 Symfony UX Map Leaflet Bridge symfony/ux-live-component 2.21.0 2.21.0 Live components for Symfony symfony/ux-map 2.21.0 2.21.0 Easily embed interactive maps in your Symfony application symfony/ux-twig-component 2.21.0 2.21.0 Twig components for Symfony symfony/validator 7.1.6 7.1.6 Provides tools to validate values symfony/web-profiler-bundle 7.1.6 7.1.6 Provides a development tool that gives detailed information about the execution of any request symfony/yaml 7.1.6 7.1.6 Loads and dumps YAML files Transitive dependencies not required in composer.json: symfony/cache 7.1.6 7.1.6 Provides extended PSR-6, PSR-16 (and tags) implementations symfony/clock 7.1.6 7.1.6 Decouples applications from the system clock symfony/config 7.1.6 7.1.6 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/contracts 3.5.0 3.5.0 A set of abstractions extracted out of the Symfony components symfony/dependency-injection 7.1.6 7.1.6 Allows you to standardize and centralize the way objects are constructed in your application symfony/doctrine-bridge 7.1.6 7.1.6 Provides integration for Doctrine with various Symfony components symfony/error-handler 7.1.6 7.1.6 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher 7.1.6 7.1.6 Provides tools that allow your application components to communicate with each other by dispatching events and listening ... symfony/expression-language 7.1.6 7.1.6 Provides an engine that can compile and evaluate expressions symfony/http-client 7.1.6 7.1.6 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-foundation 7.1.6 7.1.6 Defines an object-oriented layer for the HTTP specification symfony/http-kernel 7.1.6 7.1.6 Provides a structured process for converting a Request into a Response symfony/intl 7.1.6 7.1.6 Provides access to the localization data of the ICU library symfony/mime 7.1.6 7.1.6 Allows manipulating MIME messages symfony/monolog-bridge 7.1.6 7.1.6 Provides integration for Monolog with various Symfony components symfony/options-resolver 7.1.6 7.1.6 Provides an improved replacement for the array_replace PHP function symfony/password-hasher 7.1.6 7.1.6 Provides password hashing utilities symfony/polyfill-intl-grapheme 1.31.0 1.31.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu 1.31.0 1.31.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn 1.31.0 1.31.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer 1.31.0 1.31.0 Symfony polyfill for intl's Normalizer class and related functions symfony/process 7.1.6 7.1.6 Executes commands in sub-processes symfony/property-access 7.1.6 7.1.6 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info 7.1.6 7.1.6 Extracts information about PHP class' properties using metadata of popular sources symfony/routing 7.1.6 7.1.6 Maps an HTTP request to a set of configuration variables symfony/security-acl 3.3.4 3.3.4 Symfony Security Component - ACL (Access Control List) symfony/security-core 7.1.6 7.1.6 Symfony Security Component - Core Library symfony/security-http 7.1.6 7.1.6 Symfony Security Component - HTTP Integration symfony/twig-bridge 7.1.6 7.1.6 Provides integration for Twig with various Symfony components symfony/type-info 7.1.6 7.1.6 Extracts PHP types information. symfony/var-dumper 7.1.6 7.1.6 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter 7.1.6 7.1.6 Allows exporting any serializable PHP data structure to plain PHP code ```

PHP version

$ php -v
PHP 8.4.0RC3 (cli) (built: Oct 24 2024 23:31:06) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.0RC3, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.0RC3, Copyright (c), by Zend Technologies

Subject

Not possible to use with doctrine/orm ^3.3 due to invalid mapping definition

Minimal repository with the bug

n/a

Steps to reproduce

Use doctrine/orm ^3.3

Expected results

Actual results

Mapping exception:

Mapping
-------
In MappingException.php line 555:

  You have specified invalid cascade options for App\Entity\Sonata\Classification\Category::$parent: 'merge'; available options: 'remove', 'persist', 'refresh', and 'detach'

doctrine:schema:validate [--em EM] [--skip-mapping] [--skip-sync] [--skip-property-types]
VincentLanglet commented 1 day ago

Hi @fbuchlak can you provide a PR ?

I assume https://github.com/sonata-project/SonataClassificationBundle/blob/40c0c519a60dc7e57c46acb2adbf32863c8aadbf/src/DependencyInjection/SonataClassificationExtension.php#L140 should be updated based on ORM version.

haivala commented 20 hours ago

I think the question is does it need the merge at all.

VincentLanglet commented 18 hours ago

I think the question is does it need the merge at all.

I would say no, but i'm afraid removing it would be a BC break