You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Direct dependencies required in composer.json:
symfony/asset v5.4.31 v6.0.19 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/browser-kit v5.4.31 v6.0.19 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/console v5.4.34 v6.0.19 Eases the creation of beautiful and testable command line interfaces
symfony/css-selector v5.4.26 v6.0.19 Converts CSS selectors to XPath expressions
symfony/debug-bundle v5.4.26 v6.0.19 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework
symfony/dotenv v5.4.34 v6.0.19 Registers environment variables from a .env file
symfony/expression-language v5.4.21 v6.0.19 Provides an engine that can compile and evaluate expressions
symfony/finder v5.4.27 v6.0.19 Finds files and directories via an intuitive fluent interface
symfony/flex v2.4.3 v2.4.3 Composer plugin for Symfony
symfony/form v5.4.33 v6.0.19 Allows to easily create, process and reuse HTML forms
symfony/framework-bundle v5.4.34 v6.0.19 Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client v5.4.34 v6.0.20 Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/intl v5.4.30 v6.0.19 Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library
symfony/mailer v5.4.34 v6.0.19 Helps sending emails
symfony/maker-bundle v1.50.0 v1.50.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime v5.4.26 v6.0.19 Allows manipulating MIME messages
symfony/monolog-bundle v3.10.0 v3.10.0 Symfony MonologBundle
symfony/phpunit-bridge v5.4.34 v7.0.2 Provides utilities for PHPUnit, especially user deprecation notices management
symfony/process v5.4.34 v6.0.19 Executes commands in sub-processes
symfony/property-access v5.4.26 v6.0.19 Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info v5.4.24 v6.0.19 Extracts information about PHP class' properties using metadata of popular sources
symfony/proxy-manager-bridge v5.4.21 v6.0.19 Provides integration for ProxyManager with various Symfony components
symfony/runtime v5.4.26 v6.0.19 Enables decoupling PHP applications from global state
symfony/security-bundle v5.4.34 v6.0.20 Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/serializer v5.4.34 v6.0.19 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/stopwatch v5.4.21 v6.0.19 Provides a way to profile code
symfony/translation v5.4.31 v6.0.19 Provides tools to internationalize your application
symfony/twig-bundle v5.4.31 v6.0.19 Provides a tight integration of Twig into the Symfony full-stack framework
symfony/validator v5.4.34 v6.0.19 Provides tools to validate values
symfony/web-profiler-bundle v5.4.34 v6.0.19 Provides a development tool that gives detailed information about the execution of any request
symfony/webpack-encore-bundle v1.17.2 v1.17.2 Integration with your Symfony app & Webpack Encore!
symfony/yaml v5.4.31 v6.0.19 Loads and dumps YAML files
Transitive dependencies not required in composer.json:
symfony/cache v6.0.19 v6.0.19 Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts v3.0.2 v3.0.2 Generic abstractions related to caching
symfony/config v5.4.31 v6.0.19 Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/dependency-injection v5.4.34 v6.0.20 Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts v3.0.2 v3.0.2 A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge v5.4.34 v6.0.19 Provides integration for Doctrine with various Symfony components
symfony/dom-crawler v6.0.19 v6.0.19 Eases DOM navigation for HTML and XML documents
symfony/error-handler v6.0.19 v6.0.19 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v5.4.34 v6.0.19 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.0.2 v3.0.2 Generic abstractions related to dispatching event
symfony/filesystem v5.4.25 v6.0.19 Provides basic utilities for the filesystem
symfony/http-client-contracts v2.5.2 v3.0.2 Generic abstractions related to HTTP clients
symfony/http-foundation v5.4.34 v6.0.20 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v5.4.34 v6.0.20 Provides a structured process for converting a Request into a Response
symfony/monolog-bridge v5.4.31 v6.0.19 Provides integration for Monolog with various Symfony components
symfony/options-resolver v5.4.21 v6.0.19 Provides an improved replacement for the array_replace PHP function
symfony/password-hasher v6.0.19 v6.0.19 Provides password hashing utilities
symfony/polyfill-php80 v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81 v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/psr-http-message-bridge v2.3.1 v2.3.1 PSR HTTP message bridge
symfony/routing v5.4.34 v6.0.19 Maps an HTTP request to a set of configuration variables
symfony/security-acl v3.3.3 v3.3.3 Symfony Security Component - ACL (Access Control List)
symfony/security-core v5.4.30 v6.0.19 Symfony Security Component - Core Library
symfony/security-csrf v5.4.27 v6.0.19 Symfony Security Component - CSRF Library
symfony/security-guard v5.4.27 v5.4.27 Symfony Security Component - Guard
symfony/security-http v5.4.31 v6.0.20 Symfony Security Component - HTTP Integration
symfony/service-contracts v2.5.2 v3.0.2 Generic abstractions related to writing services
symfony/string v5.4.34 v6.0.19 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation-contracts v2.5.2 v3.0.2 Generic abstractions related to translation
symfony/twig-bridge v5.4.34 v6.0.19 Provides integration for Twig with various Symfony components
symfony/var-dumper v6.0.19 v6.0.19 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter v6.0.19 v6.0.19 Allows exporting any serializable PHP data structure to plain PHP code
PHP version
PHP 8.0.30 (cli) (built: Sep 1 2023 14:08:48) ( NTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.30, Copyright (c) Zend Technologies
with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies
with Xdebug v3.2.2, Copyright (c) 2002-2023, by Derick Rethans
Subject
I am using Gedmo translations.
By reading the queries in the log file, I noticed that my entities were fetched twice on pages were a single entity is displayed, such as the edit page.
I narrowed the cause down to \Sonata\TranslationBundle\Admin\Extension\Gedmo\TranslatableAdminExtension::setLocale.
Maybe my code is is wrong, but this is what happens:
The entity is loaded and the admin extension tries to update the locale in setLocale(). When the locale is null and the locale to be set is the default locale, it is not necessary to refresh the entity.
I think an optimization can be made where the default locale is put in the locale property when it is null, so a refresh is not necessary in that case.
Maybe I should put my default locale as the default value of the locale property, but that is not what the Gedmo docs mention.
The text was updated successfully, but these errors were encountered:
Environment
Sonata packages
show
Direct dependencies required in composer.json:
sonata-project/admin-bundle 4.29.2 4.29.2 The missing Symfony Admin Generator
sonata-project/doctrine-orm-admin-bundle 4.15.0 4.15.0 Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/formatter-bundle 5.3.0 5.3.0 Symfony SonataFormatterBundle
sonata-project/intl-bundle 3.2.0 3.2.0 Symfony SonataIntlBundle
sonata-project/media-bundle 4.11.0 4.11.0 Symfony SonataMediaBundle
sonata-project/translation-bundle 3.3.0 3.3.0 SonataTranslationBundle
Transitive dependencies not required in composer.json:
sonata-project/block-bundle 5.1.0 5.1.0 Symfony SonataBlockBundle
sonata-project/doctrine-extensions 2.3.0 2.3.0 Doctrine2 behavioral extensions
sonata-project/exporter 3.3.0 3.3.0 Lightweight Exporter library
sonata-project/form-extensions 2.3.0 2.3.0 Symfony form extensions
sonata-project/twig-extensions 2.4.0 2.4.0 Sonata twig extensions
Symfony packages
show
Direct dependencies required in composer.json: symfony/asset v5.4.31 v6.0.19 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files symfony/browser-kit v5.4.31 v6.0.19 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/console v5.4.34 v6.0.19 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.4.26 v6.0.19 Converts CSS selectors to XPath expressions symfony/debug-bundle v5.4.26 v6.0.19 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework symfony/dotenv v5.4.34 v6.0.19 Registers environment variables from a .env file symfony/expression-language v5.4.21 v6.0.19 Provides an engine that can compile and evaluate expressions symfony/finder v5.4.27 v6.0.19 Finds files and directories via an intuitive fluent interface symfony/flex v2.4.3 v2.4.3 Composer plugin for Symfony symfony/form v5.4.33 v6.0.19 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v5.4.34 v6.0.19 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client v5.4.34 v6.0.20 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/intl v5.4.30 v6.0.19 Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library symfony/mailer v5.4.34 v6.0.19 Helps sending emails symfony/maker-bundle v1.50.0 v1.50.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code. symfony/mime v5.4.26 v6.0.19 Allows manipulating MIME messages symfony/monolog-bundle v3.10.0 v3.10.0 Symfony MonologBundle symfony/phpunit-bridge v5.4.34 v7.0.2 Provides utilities for PHPUnit, especially user deprecation notices management symfony/process v5.4.34 v6.0.19 Executes commands in sub-processes symfony/property-access v5.4.26 v6.0.19 Provides functions to read and write from/to an object or array using a simple string notation symfony/property-info v5.4.24 v6.0.19 Extracts information about PHP class' properties using metadata of popular sources symfony/proxy-manager-bridge v5.4.21 v6.0.19 Provides integration for ProxyManager with various Symfony components symfony/runtime v5.4.26 v6.0.19 Enables decoupling PHP applications from global state symfony/security-bundle v5.4.34 v6.0.20 Provides a tight integration of the Security component into the Symfony full-stack framework symfony/serializer v5.4.34 v6.0.19 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/stopwatch v5.4.21 v6.0.19 Provides a way to profile code symfony/translation v5.4.31 v6.0.19 Provides tools to internationalize your application symfony/twig-bundle v5.4.31 v6.0.19 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator v5.4.34 v6.0.19 Provides tools to validate values symfony/web-profiler-bundle v5.4.34 v6.0.19 Provides a development tool that gives detailed information about the execution of any request symfony/webpack-encore-bundle v1.17.2 v1.17.2 Integration with your Symfony app & Webpack Encore! symfony/yaml v5.4.31 v6.0.19 Loads and dumps YAML files
Transitive dependencies not required in composer.json:
symfony/cache v6.0.19 v6.0.19 Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts v3.0.2 v3.0.2 Generic abstractions related to caching
symfony/config v5.4.31 v6.0.19 Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/dependency-injection v5.4.34 v6.0.20 Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts v3.0.2 v3.0.2 A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge v5.4.34 v6.0.19 Provides integration for Doctrine with various Symfony components
symfony/dom-crawler v6.0.19 v6.0.19 Eases DOM navigation for HTML and XML documents
symfony/error-handler v6.0.19 v6.0.19 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v5.4.34 v6.0.19 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.0.2 v3.0.2 Generic abstractions related to dispatching event
symfony/filesystem v5.4.25 v6.0.19 Provides basic utilities for the filesystem
symfony/http-client-contracts v2.5.2 v3.0.2 Generic abstractions related to HTTP clients
symfony/http-foundation v5.4.34 v6.0.20 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v5.4.34 v6.0.20 Provides a structured process for converting a Request into a Response
symfony/monolog-bridge v5.4.31 v6.0.19 Provides integration for Monolog with various Symfony components
symfony/options-resolver v5.4.21 v6.0.19 Provides an improved replacement for the array_replace PHP function
symfony/password-hasher v6.0.19 v6.0.19 Provides password hashing utilities
symfony/polyfill-php80 v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81 v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/psr-http-message-bridge v2.3.1 v2.3.1 PSR HTTP message bridge
symfony/routing v5.4.34 v6.0.19 Maps an HTTP request to a set of configuration variables
symfony/security-acl v3.3.3 v3.3.3 Symfony Security Component - ACL (Access Control List)
symfony/security-core v5.4.30 v6.0.19 Symfony Security Component - Core Library
symfony/security-csrf v5.4.27 v6.0.19 Symfony Security Component - CSRF Library
symfony/security-guard v5.4.27 v5.4.27 Symfony Security Component - Guard
symfony/security-http v5.4.31 v6.0.20 Symfony Security Component - HTTP Integration
symfony/service-contracts v2.5.2 v3.0.2 Generic abstractions related to writing services
symfony/string v5.4.34 v6.0.19 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation-contracts v2.5.2 v3.0.2 Generic abstractions related to translation
symfony/twig-bridge v5.4.34 v6.0.19 Provides integration for Twig with various Symfony components
symfony/var-dumper v6.0.19 v6.0.19 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter v6.0.19 v6.0.19 Allows exporting any serializable PHP data structure to plain PHP code
PHP version
Subject
I am using Gedmo translations.
By reading the queries in the log file, I noticed that my entities were fetched twice on pages were a single entity is displayed, such as the edit page.
I narrowed the cause down to
\Sonata\TranslationBundle\Admin\Extension\Gedmo\TranslatableAdminExtension::setLocale
.Maybe my code is is wrong, but this is what happens:
The entity is loaded and the admin extension tries to update the locale in
setLocale()
. When the locale is null and the locale to be set is the default locale, it is not necessary torefresh
the entity.I think an optimization can be made where the default locale is put in the locale property when it is null, so a
refresh
is not necessary in that case.Maybe I should put my default locale as the default value of the locale property, but that is not what the Gedmo docs mention.
The text was updated successfully, but these errors were encountered: