Closed hirenchhatbar closed 7 months ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have the same issue. Can this issue be reopened? I have to do extra validations as workaround. I would expect deletion of translations only after the main entity was deleted successfully, instead of the translations are being deleted before.
"doctrine/doctrine-bundle": "^2.12",
"doctrine/orm": "^3.2",
"stof/doctrine-extensions-bundle": "^1.12",
stof/doctrine-extensions-bundle requires: gedmo/doctrine-extensions ^3.15.0
#[ORM\Column(nullable: true)]
#[Gedmo\Translatable]
private string $name;
When following fails because $entity had references, translations of $entity are unintendedly removed.
$this->entityManager->remove($entity);
$this->entityManager->flush();
Environment
Dev
Package
show
``` $ composer show --latest gedmo/doctrine-extensions Info from https://repo.packagist.org: #StandWithUkraine name : gedmo/doctrine-extensions descrip. : Doctrine behavioral extensions keywords : Blameable, behaviors, doctrine, extensions, gedmo, loggable, nestedset, odm, orm, sluggable, sortable, timestampable, translatable, tree, uploadable versions : * v3.12.0 latest : v3.12.0 type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : http://gediminasm.org/ source : [git] https://github.com/doctrine-extensions/DoctrineExtensions.git eef4b4978118fdb4c0a03509325e807ad96e3bec dist : [zip] https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/eef4b4978118fdb4c0a03509325e807ad96e3bec eef4b4978118fdb4c0a03509325e807ad96e3bec path : /var/www/html/api-dev-clearlyinteriors.managemepro.com/vendor/gedmo/doctrine-extensions names : gedmo/doctrine-extensions support email : gediminas.morkevicius@gmail.com issues : https://github.com/doctrine-extensions/DoctrineExtensions/issues source : https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.12.0 wiki : https://github.com/Atlantic18/DoctrineExtensions/tree/main/doc autoload psr-4 Gedmo\ => src/ requires behat/transliterator ~1.2 doctrine/annotations ^1.13 || ^2.0 doctrine/collections ^1.2 || ^2.0 doctrine/common ^2.13 || ^3.0 doctrine/event-manager ^1.2 || ^2.0 doctrine/persistence ^2.2 || ^3.0 php ^7.2 || ^8.0 psr/cache ^1 || ^2 || ^3 symfony/cache ^4.4 || ^5.3 || ^6.0 symfony/deprecation-contracts ^2.1 || ^3.0 requires (dev) doctrine/cache ^1.11 || ^2.0 doctrine/dbal ^2.13.1 || ^3.2 doctrine/doctrine-bundle ^2.3 doctrine/mongodb-odm ^2.3 doctrine/orm ^2.10.2 friendsofphp/php-cs-fixer ^3.4.0 <3.10 nesbot/carbon ^2.55 phpstan/phpstan ^1.10.2 phpstan/phpstan-doctrine ^1.0 phpstan/phpstan-phpunit ^1.0 phpunit/phpunit ^8.5 || ^9.5 rector/rector ^0.15.20 symfony/console ^4.4 || ^5.3 || ^6.0 symfony/phpunit-bridge ^6.0 symfony/yaml ^4.4 || ^5.3 || ^6.0 suggests doctrine/mongodb-odm to use the extensions with the MongoDB ODM doctrine/orm to use the extensions with the ORM conflicts doctrine/dbal <2.13.1 || ^3.0 <3.2 doctrine/mongodb-odm <2.3 doctrine/orm <2.10.2 sebastian/comparator <2.0 ```
Doctrine packages
show
``` $ composer show --latest 'doctrine/*' Info from https://repo.packagist.org: #StandWithUkraine Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version Direct dependencies required in composer.json: doctrine/doctrine-bundle 2.10.1 2.10.1 Symfony DoctrineBundle doctrine/doctrine-fixtures-bundle 3.4.4 3.4.4 Symfony DoctrineFixturesBundle doctrine/orm 2.15.4 2.16.0 Object-Relational-Mapper for PHP doctrine/persistence 3.2.0 3.2.0 The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object ... Transitive dependencies not required in composer.json: doctrine/annotations 2.0.1 2.0.1 Docblock Annotations Parser doctrine/cache 2.2.0 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, mem... doctrine/collections 2.1.3 2.1.3 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays. doctrine/common 3.4.3 3.4.3 PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend ... doctrine/data-fixtures 1.6.6 1.6.6 Data Fixtures for all Doctrine Object Managers doctrine/dbal 3.6.5 3.6.5 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/deprecations v1.1.1 v1.1.1 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations o... doctrine/event-manager 1.2.0 2.0.0 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects. doctrine/inflector 2.0.8 2.0.8 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and s... doctrine/instantiator 2.0.0 2.0.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 2.1.0 3.0.0 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. doctrine/sql-formatter 1.1.3 1.1.3 a PHP SQL highlighting library ```
PHP version
Translations get removed even when main entity is not deleted due to foreign key constraints
Steps to reproduce
Main entity Category with translations
Personal translation class
/**
// vendor/gedmo/doctrine-extensions/src/Translatable/TranslatableListener.php
/**
So, it seems that this part of code anyway deletes the translations even though the main entity is not deleted from database and gets failed.
Expected results
The translations should not be removed when main entity is not removed and get failed
Actual results
System should not delete translations