a2lix / TranslationFormBundle

Ease translations with some dedicated Symfony form types
https://a2lix.fr/bundles/translation-form
MIT License
331 stars 138 forks source link

TranslationsType in combination with LiveCollectionType translatable fields are not displayed when forms re-render by an add/delete action #396

Closed Moussa112 closed 2 hours ago

Moussa112 commented 4 hours ago

Environment

Composer packages

$ composer show a2lix/auto-form-bundle 0.4.7 Automate form building a2lix/translation-form-bundle 3.2.4 Translate your doctrine objects easily with some helpers behat/transliterator 1.5.0 String transliterator brick/math 0.12.1 Arbitrary-precision arithmetic library cweagans/composer-patches 1.7.3 Provides a way to patch Composer packages. doctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others. doctrine/collections 2.2.2 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays. doctrine/common 3.4.4 PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much m... doctrine/data-fixtures 1.7.0 Data Fixtures for all Doctrine Object Managers doctrine/dbal 3.8.6 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/deprecations 1.1.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages. doctrine/doctrine-bundle 2.12.0 Symfony DoctrineBundle doctrine/doctrine-fixtures-bundle 3.6.1 Symfony DoctrineFixturesBundle doctrine/doctrine-migrations-bundle 3.3.1 Symfony DoctrineMigrationsBundle doctrine/event-manager 2.0.1 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.10 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words. doctrine/instantiator 2.0.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 3.0.1 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. doctrine/migrations 3.8.0 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying chan... doctrine/orm 2.18.0 Object-Relational-Mapper for PHP doctrine/persistence 3.3.3 The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share. doctrine/sql-formatter 1.4.0 a PHP SQL highlighting library egulias/email-validator 4.0.2 A library for validating emails against several RFCs elasticsearch/elasticsearch 7.17.2 PHP Client for Elasticsearch ezimuel/guzzlestreams 3.1.0 Fork of guzzle/streams (abandoned) to be used with elasticsearch-php ezimuel/ringphp 1.2.2 Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php gedmo/doctrine-extensions 3.16.1 Doctrine behavioral extensions gehrisandro/tailwind-merge-php 1.1.2 TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them imagine/imagine 1.3.5 Image processing for PHP 5.3 jms/metadata 2.8.0 Class/method/property metadata management in PHP knplabs/doctrine-behaviors dev-sf7.0 f956acc Doctrine Behavior Traits knplabs/knp-components 4.4.0 Knplabs component library knplabs/knp-paginator-bundle 6.4.0 Paginator bundle for Symfony to automate pagination and simplify sorting and other features liip/imagine-bundle 2.13.1 This bundle provides an image manipulation abstraction toolkit for Symfony-based projects. masterminds/html5 2.9.0 An HTML5 parser and serializer. monolog/monolog 3.7.0 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.12.0 Create deep copies (clones) of your objects nette/utils 4.0.4 🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc. nikic/php-parser 5.1.0 A PHP parser written in PHP phar-io/manifest 2.0.4 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.2.1 Library for handling version information and constraints phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.4.1 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. phpdocumentor/type-resolver 1.8.2 A PSR-5 based resolver of Class names, Types and Structural Element Names phpstan/phpdoc-parser 1.29.1 PHPDoc parser with support for nullable, intersection and generic types phpunit/php-code-coverage 11.0.5 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 5.0.1 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 5.0.1 Invoke callables with a timeout phpunit/php-text-template 4.0.1 Simple template engine. phpunit/php-timer 7.0.1 Utility class for timing phpunit/phpunit 11.2.8 The PHP Unit Testing framework. psr/cache 3.0.0 Common interface for caching libraries psr/clock 1.0.0 Common interface for reading the clock. psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/link 2.0.1 Common interfaces for HTTP links psr/log 3.0.0 Common interface for logging libraries psr/simple-cache 3.0.0 Common interfaces for simple caching ramsey/collection 2.0.0 A PHP library for representing and manipulating collections. ramsey/uuid 4.7.6 A PHP library for generating and working with universally unique identifiers (UUIDs). ramsey/uuid-doctrine 2.1.0 Use ramsey/uuid as a Doctrine field type. react/promise 2.11.0 A lightweight implementation of CommonJS Promises/A for PHP saggre/phpdocumentor-markdown 0.1.4 Markdown template for phpDocumentor3 sebastian/cli-parser 3.0.2 Library for parsing CLI options sebastian/code-unit 3.0.1 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 4.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 6.0.1 Provides the functionality to compare PHP values for equality sebastian/complexity 4.0.1 Library for calculating the complexity of PHP code units sebastian/diff 6.0.2 Diff implementation sebastian/environment 7.2.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 6.1.3 Provides the functionality to export PHP variables for visualization sebastian/global-state 7.0.2 Snapshotting of global state sebastian/lines-of-code 3.0.1 Library for counting the lines of code in PHP source code sebastian/object-enumerator 6.0.1 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 4.0.1 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 6.0.2 Provides functionality to recursively process PHP variables sebastian/type 5.0.1 Collection of value objects that represent the types of the PHP type system sebastian/version 5.0.1 Library that helps with managing the version number of Git-hosted PHP projects stof/doctrine-extensions-bundle 1.12.0 Integration of the gedmo/doctrine-extensions with Symfony symfony/apache-pack 1.0.1 A pack for Apache support in Symfony symfony/asset 7.1.1 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/browser-kit 7.1.1 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/cache 7.1.2 Provides extended PSR-6, PSR-16 (and tags) implementations symfony/cache-contracts 3.5.0 Generic abstractions related to caching symfony/clock 7.1.1 Decouples applications from the system clock symfony/config 7.1.1 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console 7.1.2 Eases the creation of beautiful and testable command line interfaces symfony/css-selector 7.1.1 Converts CSS selectors to XPath expressions symfony/debug-bundle 7.1.1 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework symfony/dependency-injection 7.1.2 Allows you to standardize and centralize the way objects are constructed in your application symfony/deprecation-contracts 3.5.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge 7.1.2 Provides integration for Doctrine with various Symfony components symfony/doctrine-messenger 7.1.2 Symfony Doctrine Messenger Bridge symfony/dom-crawler 7.1.1 Eases DOM navigation for HTML and XML documents symfony/dotenv 7.1.1 Registers environment variables from a .env file symfony/error-handler 7.1.2 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher 7.1.1 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts 3.5.0 Generic abstractions related to dispatching event symfony/expression-language 7.1.1 Provides an engine that can compile and evaluate expressions symfony/filesystem 7.1.2 Provides basic utilities for the filesystem symfony/finder 7.1.1 Finds files and directories via an intuitive fluent interface symfony/flex 2.4.5 Composer plugin for Symfony symfony/form 7.1.1 Allows to easily create, process and reuse HTML forms symfony/framework-bundle 7.1.2 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client 7.1.2 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts 3.5.0 Generic abstractions related to HTTP clients symfony/http-foundation 7.1.1 Defines an object-oriented layer for the HTTP specification symfony/http-kernel 7.1.2 Provides a structured process for converting a Request into a Response symfony/intl 7.1.1 Provides access to the localization data of the ICU library symfony/mailer 7.1.2 Helps sending emails symfony/maker-bundle 1.60.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/messenger 7.1.2 Helps applications send and receive messages to/from other applications or via message queues symfony/mime 7.1.2 Allows manipulating MIME messages symfony/monolog-bridge 7.1.1 Provides integration for Monolog with various Symfony components symfony/monolog-bundle 3.10.0 Symfony MonologBundle symfony/notifier 7.1.2 Sends notifications via one or more channels (email, SMS, ...) symfony/options-resolver 7.1.1 Provides an improved replacement for the array_replace PHP function symfony/password-hasher 7.1.1 Provides password hashing utilities symfony/phpunit-bridge 7.1.2 Provides utilities for PHPUnit, especially user deprecation notices management symfony/polyfill-intl-grapheme 1.30.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu 1.30.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn 1.30.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer 1.30.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring 1.30.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php83 1.30.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions symfony/process 7.1.1 Executes commands in sub-processes symfony/property-access 7.1.1 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info 7.1.2 Extracts information about PHP class' properties using metadata of popular sources symfony/routing 7.1.1 Maps an HTTP request to a set of configuration variables symfony/runtime 7.1.1 Enables decoupling PHP applications from global state symfony/security-bundle 7.1.2 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/security-core 7.1.2 Symfony Security Component - Core Library symfony/security-csrf 7.1.1 Symfony Security Component - CSRF Library symfony/security-http 7.1.2 Symfony Security Component - HTTP Integration symfony/serializer 7.1.2 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/service-contracts 3.5.0 Generic abstractions related to writing services symfony/stimulus-bundle 2.18.1 Integration with your Symfony app & Stimulus! symfony/stopwatch 7.1.1 Provides a way to profile code symfony/string 7.1.2 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.1 Provides tools to internationalize your application symfony/translation-contracts 3.5.0 Generic abstractions related to translation symfony/twig-bridge 7.1.1 Provides integration for Twig with various Symfony components symfony/twig-bundle 7.1.1 Provides a tight integration of Twig into the Symfony full-stack framework symfony/type-info 7.1.1 Extracts PHP types information. symfony/ux-autocomplete 2.18.0 JavaScript Autocomplete functionality for Symfony symfony/ux-icons 2.x-dev b5ffb86 Renders local and remote SVG icons in your Twig templates. symfony/ux-live-component 2.18.1 Live components for Symfony symfony/ux-turbo 2.18.0 Hotwire Turbo integration for Symfony symfony/ux-twig-component 2.18.1 Twig components for Symfony symfony/validator 7.1.2 Provides tools to validate values symfony/var-dumper 7.1.2 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter 7.1.2 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-link 7.1.1 Manages links between resources symfony/web-profiler-bundle 7.1.2 Provides a development tool that gives detailed information about the execution of any request symfony/webpack-encore-bundle 2.1.1 Integration with your Symfony app & Webpack Encore! symfony/yaml 7.1.1 Loads and dumps YAML files symfonycasts/dynamic-forms 0.1.2 Add dynamic/dependent fields to Symfony forms tales-from-a-dev/flowbite-bundle 0.6.0 A Symfony form theme for Flowbite tales-from-a-dev/twig-tailwind-extra 0.2.1 A Twig extension for Tailwind theseer/tokenizer 1.2.3 A small library for converting tokenized PHP source code into XML and potentially other formats twig/extra-bundle 3.10.0 A Symfony bundle for extra Twig extensions twig/intl-extra 3.10.0 A Twig extension for Intl twig/string-extra 3.10.0 A Twig extension for Symfony String twig/twig 3.10.3 Twig, the flexible, fast, and secure template language for PHP vich/uploader-bundle 2.4.0 Ease file uploads attached to entities webmozart/assert 1.11.0 Assertions to validate method input/output with nice error messages.

PHP version

$ php -v
PHP 8.3.9

Subject

When I am using a TranslationsType in combination with a LiveCollectionType and I add or remove an item from my LiveCollection my translatable fields from my TranslationsType visually disappear from my ui. The items still exist in my dom.

Is this an issue with the symfony ux live components or with the TranslationsType from this bundle?

Steps to reproduce

$builder->add('prices', LiveCollectionType::class, [
    'entry_type' => PricingType::class,
    'allow_add' => true,
    'allow_delete' => true,
    'by_reference' => false,
    ...
])
->add('translations', TranslationsType::class, [
    'fields' => [
        'description' => ['field_type' => TextAreaType::class],
        'default_locale' => 'en',
        'required_locales' => 'en',
]);

In my live component I render my form like so:

<div>
    {{ form_start(form) }}
        {% from "translationTypeMacro.html.twig" import partialTranslations %}
        {{ partialTranslations(form.translations, ['descriptionVoice']) }}
        {{ partialTranslations(form.translations, ['descriptionData']) }}
        {{ form_widget(form.prices) }}
    {{ form_end(form) }}     
</div>

Expected results

My translationfields remain visible after re-render when add/delete action happens

Actual results

My translationfields are not visible after re-render when add/delete action happens

Moussa112 commented 2 hours ago

Issue caused by my implementation, not the bundle.