sonata-project / form-extensions Goto Github PK
View Code? Open in Web Editor NEWSymfony form extensions
Home Page: https://docs.sonata-project.org/projects/form-extensions
License: MIT License
Symfony form extensions
Home Page: https://docs.sonata-project.org/projects/form-extensions
License: MIT License
We are somehow stuck with the DateTime form type, since it is coupled with the library we are using at the frontend to render it:
https://github.com/Eonasdan/bootstrap-datetimepicker/ -> version 3.1.3
Not only is outdated (there is a version 4, 5, 6 on that repository), but also it got a name change, at least one major rewrite, some options changed a lot, etc...
Also there is another problem here, the form type is defined here, but the library is added here: https://github.com/sonata-project/SonataAdminBundle/tree/4.x/assets/vendor
which is a problem because:
I think we should find a solution before release 2.0, wdyt @VincentLanglet ?
There are also some really old PRs and issues on CoreBundle (when everything was together):
sonata-project/SonataCoreBundle#138
sonata-project/SonataCoreBundle#149
$ composer show --latest 'sonata-project/*'
Direct dependencies required in composer.json:
sonata-project/admin-bundle 4.29.3 4.29.3 The missing Symfony Admin Generator
sonata-project/classification-bundle 4.8.0 4.8.0 Symfony SonataClassificationBundle
sonata-project/doctrine-extensions 2.3.0 2.3.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 4.15.0 4.15.0 Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 3.3.0 3.3.0 Lightweight Exporter library
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 dev-3.x-dev-kit e6ea40d dev-3.x-dev-kit e6ea40d SonataTranslationBundle
Transitive dependencies not required in composer.json:
sonata-project/block-bundle 5.1.0 5.1.0 Symfony SonataBlockBundle
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
We're using symfony instances on our staging system in subdirectories. Unfortunately we ran into the problem, that the public assets of the sonataform bundle points to absolute paths.
I think the paths need an relative "./" to be more flexible. See entrypoints.json and manifest.json.
I'm not so familiar with the webpack config, but I think changing the public path may deals with this fact, see webpack.config.js.
$ composer show --latest 'sonata-project/*'
# Put the result here.
sonata-project/admin-bundle 3.68.0 3.68.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.18.5 4.2.0 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/core-bundle 3.20.0 3.20.0 Symfony SonataCoreBundle (abandoned)
sonata-project/doctrine-extensions 1.6.0 1.6.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.18.0 3.18.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 2.2.0 2.2.0 Lightweight Exporter library
sonata-project/form-extensions 0.1.0 1.4.0 Symfony form extensions
sonata-project/twig-extensions 0.1.0 1.3.0 Sonata twig extensions
$ composer show --latest 'symfony/*'
# Put the result here.
symfony/asset v4.4.9 v5.1.0 Symfony Asset Component
symfony/browser-kit v4.4.9 v5.1.0 Symfony BrowserKit Component
symfony/cache v5.1.0 v5.1.0 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/config v4.4.9 v5.1.0 Symfony Config Component
symfony/console v4.4.9 v5.1.0 Symfony Console Component
symfony/contracts v1.1.8 v2.1.2 A set of abstractions extracted out of the Symfony components
symfony/css-selector v4.4.9 v5.1.0 Symfony CssSelector Component
symfony/debug v4.4.9 v4.4.9 Symfony Debug Component
symfony/debug-bundle v4.4.9 v5.1.0 Symfony DebugBundle
symfony/dependency-injection v4.4.9 v5.1.0 Symfony DependencyInjection Component
symfony/deprecation-contracts v2.1.2 v2.1.2 A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge v4.4.9 v5.1.0 Symfony Doctrine Bridge
symfony/dom-crawler v5.1.0 v5.1.0 Symfony DomCrawler Component
symfony/dotenv v4.4.9 v5.1.0 Registers environment variables from a .env file
symfony/error-handler v4.4.9 v5.1.0 Symfony ErrorHandler Component
symfony/event-dispatcher v4.4.9 v5.1.0 Symfony EventDispatcher Component
symfony/expression-language v4.4.9 v5.1.0 Symfony ExpressionLanguage Component
symfony/filesystem v4.4.9 v5.1.0 Symfony Filesystem Component
symfony/finder v5.1.0 v5.1.0 Symfony Finder Component
symfony/flex v1.7.1 v1.7.1 Composer plugin for Symfony
symfony/form v4.4.9 v5.1.0 Symfony Form Component
symfony/framework-bundle v4.4.9 v5.1.0 Symfony FrameworkBundle
symfony/http-foundation v4.4.9 v5.1.0 Symfony HttpFoundation Component
symfony/http-kernel v4.4.9 v5.1.0 Symfony HttpKernel Component
symfony/inflector v5.1.0 v5.1.0 Symfony Inflector Component
symfony/intl v4.4.9 v5.1.0 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/messenger v4.4.9 v5.1.0 Symfony Messenger Component
symfony/mime v5.1.0 v5.1.0 A library to manipulate MIME messages
symfony/monolog-bridge v5.1.0 v5.1.0 Symfony Monolog Bridge
symfony/monolog-bundle v3.5.0 v3.5.0 Symfony MonologBundle
symfony/options-resolver v4.4.9 v5.1.0 Symfony OptionsResolver Component
symfony/phpunit-bridge v4.4.9 v5.1.0 Symfony PHPUnit Bridge
symfony/polyfill-ctype v1.17.0 v1.17.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv v1.17.0 v1.17.0 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme v1.17.0 v1.17.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu v1.17.0 v1.17.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.17.0 v1.17.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer v1.17.0 v1.17.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.17.0 v1.17.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.17.0 v1.17.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73 v1.17.0 v1.17.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80 v1.17.0 v1.17.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-uuid v1.17.0 v1.17.0 Symfony polyfill for uuid functions
symfony/process v5.1.0 v5.1.0 Symfony Process Component
symfony/property-access v4.4.9 v5.1.0 Symfony PropertyAccess Component
symfony/routing v4.4.9 v5.1.0 Symfony Routing Component
symfony/security-acl v3.0.4 v3.0.4 Symfony Security Component - ACL (Access Control List)
symfony/security-bundle v4.4.9 v5.1.0 Symfony SecurityBundle
symfony/security-core v4.4.9 v5.1.0 Symfony Security Component - Core Library
symfony/security-csrf v4.4.9 v5.1.0 Symfony Security Component - CSRF Library
symfony/security-guard v4.4.9 v5.1.0 Symfony Security Component - Guard
symfony/security-http v4.4.9 v5.1.0 Symfony Security Component - HTTP Integration
symfony/serializer v4.4.9 v5.1.0 Symfony Serializer Component
symfony/stopwatch v4.4.9 v5.1.0 Symfony Stopwatch Component
symfony/string v5.1.0 v5.1.0 Symfony String component
symfony/swiftmailer-bundle v3.4.0 v3.4.0 Symfony SwiftmailerBundle
symfony/templating v4.4.9 v5.1.0 Symfony Templating Component
symfony/translation v4.4.9 v5.1.0 Symfony Translation Component
symfony/twig-bridge v4.4.9 v5.1.0 Symfony Twig Bridge
symfony/twig-bundle v4.4.9 v5.1.0 Symfony TwigBundle
symfony/validator v4.4.9 v5.1.0 Symfony Validator Component
symfony/var-dumper v4.4.9 v5.1.0 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter v5.1.0 v5.1.0 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle v4.4.9 v5.1.0 Symfony WebProfilerBundle
symfony/yaml v4.4.9 v5.1.0 Symfony Yaml Component
$ php -v
# Put the result here.
PHP 7.4.6 (cli) (built: May 14 2020 10:02:31) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.6, Copyright (c), by Zend Technologies
I run composer update, which updaded SonataCoreBundle from 3.19 to 3.20 and require now this extension. But translations are not loaded.
cc @wbloszyk
I think it can be deprecated. It's usage was deprecated on SonataAdminBundle 3.x.
We need to look for usage on another Sonata bundles.
Maybe ErrorElement too (but not sure about that one).
README.md
Documentation of SonataFormExtensions bundle should be shown.
When I use
->add('appendixes', CollectionType::class, [
'by_reference' => false,
], [
'edit' => 'inline',
'inline' => 'table',
])
Adding disabled => true
is changing nothing.
I expected
After doing
'btn_add' => false,
'type_options' => [
'delete' => false,
'disabled' => true,
]
I get the same result.
But I think the CollectionType could be improved by settings these options for me if I use disabled => true
. WDYT ?
$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle 3.72.0 3.72.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.20.0 4.2.0 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/doctrine-extensions 1.8.0 1.8.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.21.0 3.21.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 2.3.0 2.3.0 Lightweight Exporter library
sonata-project/form-extensions 1.5.0 1.5.0 Symfony form extensions
sonata-project/intl-bundle 2.7.0 2.7.0 Symfony SonataIntlBundle
sonata-project/twig-extensions 1.3.1 1.3.1 Sonata twig extensions
$ composer show --latest 'symfony/*'
symfony/asset v4.4.11 v4.4.11 Symfony Asset Component
symfony/browser-kit v4.4.11 v4.4.11 Symfony BrowserKit Component
symfony/cache v4.4.11 v4.4.11 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts v2.1.3 v2.1.3 Generic abstractions related to caching
symfony/config v4.4.11 v4.4.11 Symfony Config Component
symfony/console v4.4.11 v4.4.11 Symfony Console Component
symfony/css-selector v4.4.11 v4.4.11 Symfony CssSelector Component
symfony/debug v4.4.11 v4.4.11 Symfony Debug Component
symfony/debug-bundle v4.4.11 v4.4.11 Symfony DebugBundle
symfony/debug-pack v1.0.8 v1.0.8 A debug pack for Symfony projects
symfony/dependency-injection v4.4.11 v4.4.11 Symfony DependencyInjection Component
symfony/doctrine-bridge v4.4.11 v4.4.11 Symfony Doctrine Bridge
symfony/dom-crawler v4.4.11 v4.4.11 Symfony DomCrawler Component
symfony/dotenv v4.4.11 v4.4.11 Registers environment variables from a .env file
symfony/error-handler v4.4.11 v4.4.11 Symfony ErrorHandler Component
symfony/event-dispatcher v4.4.11 v4.4.11 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.9 v2.1.3 Generic abstractions related to dispatching event
symfony/expression-language v4.4.11 v4.4.11 Symfony ExpressionLanguage Component
symfony/filesystem v4.4.11 v4.4.11 Symfony Filesystem Component
symfony/finder v4.4.11 v4.4.11 Symfony Finder Component
symfony/flex v1.9.1 v1.9.1 Composer plugin for Symfony
symfony/form v4.4.11 v4.4.11 Symfony Form Component
symfony/framework-bundle v4.4.11 v4.4.11 Symfony FrameworkBundle
symfony/http-client v4.4.11 v4.4.11 Symfony HttpClient component
symfony/http-client-contracts v2.1.3 v2.1.3 Generic abstractions related to HTTP clients
symfony/http-foundation v4.4.11 v4.4.11 Symfony HttpFoundation Component
symfony/http-kernel v4.4.11 v4.4.11 Symfony HttpKernel Component
symfony/inflector v4.4.11 v4.4.11 Symfony Inflector Component
symfony/intl v4.4.11 v4.4.11 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle v1.20.0 v1.20.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime v4.4.11 v4.4.11 A library to manipulate MIME messages
symfony/monolog-bridge v4.4.11 v4.4.11 Symfony Monolog Bridge
symfony/monolog-bundle v3.5.0 v3.5.0 Symfony MonologBundle
symfony/options-resolver v4.4.11 v4.4.11 Symfony OptionsResolver Component
symfony/orm-pack v2.0.0 v2.0.0 A pack for the Doctrine ORM
symfony/phpunit-bridge v5.1.3 v5.1.3 Symfony PHPUnit Bridge
symfony/polyfill-intl-grapheme v1.18.0 v1.18.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu v1.18.0 v1.18.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.18.0 v1.18.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer v1.18.0 v1.18.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.18.0 v1.18.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.18.0 v1.18.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73 v1.18.0 v1.18.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80 v1.18.0 v1.18.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process v4.4.11 v4.4.11 Symfony Process Component
symfony/profiler-pack v1.0.4 v1.0.4 A pack for the Symfony web profiler
symfony/property-access v4.4.11 v4.4.11 Symfony PropertyAccess Component
symfony/property-info v4.4.11 v4.4.11 Symfony Property Info Component
symfony/routing v4.4.11 v4.4.11 Symfony Routing Component
symfony/security-acl v3.0.4 v3.0.4 Symfony Security Component - ACL (Access Control List)
symfony/security-bundle v4.4.11 v4.4.11 Symfony SecurityBundle
symfony/security-core v4.4.11 v4.4.11 Symfony Security Component - Core Library
symfony/security-csrf v4.4.11 v4.4.11 Symfony Security Component - CSRF Library
symfony/security-guard v4.4.11 v4.4.11 Symfony Security Component - Guard
symfony/security-http v4.4.11 v4.4.11 Symfony Security Component - HTTP Integration
symfony/serializer v4.4.11 v4.4.11 Symfony Serializer Component
symfony/serializer-pack v1.0.3 v1.0.3 A pack for the Symfony serializer
symfony/service-contracts v2.1.3 v2.1.3 Generic abstractions related to writing services
symfony/stopwatch v4.4.11 v4.4.11 Symfony Stopwatch Component
symfony/string v5.1.3 v5.1.3 Symfony String component
symfony/swiftmailer-bundle v3.4.0 v3.4.0 Symfony SwiftmailerBundle
symfony/templating v4.4.11 v4.4.11 Symfony Templating Component
symfony/test-pack v1.0.6 v1.0.6 A pack for functional and end-to-end testing within a Symfony app
symfony/translation v4.4.11 v4.4.11 Symfony Translation Component
symfony/translation-contracts v2.1.3 v2.1.3 Generic abstractions related to translation
symfony/twig-bridge v4.4.11 v4.4.11 Symfony Twig Bridge
symfony/twig-bundle v4.4.11 v4.4.11 Symfony TwigBundle
symfony/validator v4.4.11 v4.4.11 Symfony Validator Component
symfony/var-dumper v4.4.11 v4.4.11 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter v4.4.11 v4.4.11 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-link v4.4.11 v4.4.11 Symfony WebLink Component
symfony/web-profiler-bundle v4.4.11 v4.4.11 Symfony WebProfilerBundle
symfony/webpack-encore-bundle v1.7.3 v1.7.3 Integration with your Symfony app & Webpack Encore!
symfony/yaml v4.4.11 v4.4.11 Symfony Yaml Component
$ php -v
PHP 7.4.8 (cli) (built: Jul 9 2020 23:21:18) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
Hi, after a dependency upgrade i got an Exception "[LogicException] A Request must be available." when using the translation:update
command.
It comes from using the type "DatePickerType" in one of my forms, as soon as I remove it, no more error.
It seems the parent "BasePickerType" tries to access the locale from the "StackRequest" object in parameter of the constructor but in the context of a console command it's always null ?
Sorry if I missed something, thank you for your work.
In the configureFormFields() method of an admin, just add a field with "DatePickerType" as type and launch the translation:update command:
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper->add('activityMonth', DatePickerType::class, [
'label' => 'activity_month_MM_YYYY',
'format' => 'MM/yyyy',
]);
}
$ php bin/console translation:update en --dump-messages -vvv
In BasePickerType.php line 160:
[LogicException]
A Request must be available.
Exception trace:
at /var/www/vendor/sonata-project/form-extensions/src/Type/BasePickerType.php:160
Sonata\Form\Type\BasePickerType->getLocale() at /var/www/vendor/sonata-project/form-extensions/src/Type/BasePickerType.php:53
Sonata\Form\Type\BasePickerType->__construct() at /var/www/var/cache/dev/ContainerF9sHqCT/srcApp_KernelDevDebugContainer.php:11349
ContainerF9sHqCT\srcApp_KernelDevDebugContainer->getSonata_Form_Type_DatePickerService() at /var/www/vendor/symfony/dependency-injection/Container.php:450
Symfony\Component\DependencyInjection\Container->getService() at /var/www/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:40
Symfony\Component\DependencyInjection\Argument\ServiceLocator->get() at /var/www/vendor/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php:43
Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension->getType() at /var/www/vendor/symfony/form/FormRegistry.php:77
Symfony\Component\Form\FormRegistry->getType() at /var/www/vendor/symfony/form/FormFactory.php:74
Symfony\Component\Form\FormFactory->createNamedBuilder() at /var/www/vendor/symfony/form/FormBuilder.php:94
Symfony\Component\Form\FormBuilder->create() at /var/www/vendor/symfony/form/FormBuilder.php:244
Symfony\Component\Form\FormBuilder->resolveChildren() at /var/www/vendor/symfony/form/FormBuilder.php:195
Symfony\Component\Form\FormBuilder->getForm() at /var/www/vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:3394
Sonata\AdminBundle\Admin\AbstractAdmin->buildForm() at /var/www/vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:1463
Sonata\AdminBundle\Admin\AbstractAdmin->getForm() at /var/www/vendor/sonata-project/admin-bundle/src/Translator/Extractor/AdminExtractor.php:101
Sonata\AdminBundle\Translator\Extractor\AdminExtractor->extract() at /var/www/vendor/symfony/translation/Extractor/ChainExtractor.php:56
Symfony\Component\Translation\Extractor\ChainExtractor->extract() at /var/www/vendor/symfony/framework-bundle/Command/TranslationUpdateCommand.php:226
Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand->execute() at /var/www/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1018
Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/framework-bundle/Console/Application.php:97
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:271
Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/framework-bundle/Console/Application.php:83
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:147
Symfony\Component\Console\Application->run() at /var/www/bin/console:42
translation:update [--prefix [PREFIX]] [--output-format [OUTPUT-FORMAT]] [--dump-messages] [--force] [--no-backup] [--clean] [--domain [DOMAIN]] [--xliff-version [XLIFF-VERSION]] [--sort [SORT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <locale> [<bundle>]
https://github.com/sonata-project/form-extensions/blob/1.x/src/Type/EqualType.php
I need to check again but I think that the EqualType is only used for filters.
It's used in SonataAdmin and SonataDoctrineORM.
Since it's only for the operator of the filter, it makes more sens to
The website given in the README file does not exist. I can't seem to find the docs on https://sonata-project.org/ at all.
$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle 3.35.2 3.39.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.12.1 3.12.1 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/core-bundle 3.11.1 3.11.2 Symfony SonataCoreBundle
sonata-project/datagrid-bundle 2.3.1 2.3.1 Symfony SonataDatagridBundle
sonata-project/doctrine-orm-admin-bundle 3.6.1 3.6.1 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 1.9.0 1.9.1 Lightweight Exporter library
sonata-project/intl-bundle 2.4.1 2.5.0 Symfony SonataIntlBundle
sonata-project/translation-bundle 2.3.0 2.3.1 SonataTranslationBundle
$ composer show --latest 'symfony/*'
symfony/monolog-bundle v3.3.0 v3.3.0 Symfony MonologBundle
symfony/phpunit-bridge v3.4.11 v4.1.4 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.8.0 v1.9.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype v1.8.0 v1.9.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu v1.8.0 v1.9.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.8.0 v1.9.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.8.0 v1.9.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.8.0 v1.9.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.8.0 v1.9.0 Symfony utilities for portability of PHP codes
symfony/security-acl v3.0.1 v3.0.1 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.7 v3.2.3 Symfony SwiftmailerBundle
symfony/symfony v3.4.11 v4.1.4 The Symfony PHP framework
$ php -v
PHP 7.1.20-1+0~20180910100532.3+stretch~1.gbp17c613 (cli) (built: Sep 10 2018 10:05:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.20-1+0~20180910100532.3+stretch~1.gbp17c613, Copyright (c) 1999-2018, by Zend Technologies
When I send any day of any year with september as a month it's not getting the date.
First I make a composer update.
I'm using sonata admin and setted up the config file with:
sonata_intl:
timezone:
default: America/Argentina/Ushuaia
and
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
form_themes:
- 'bootstrap_3_layout.html.twig'
- 'SonataCoreBundle:Form:datepicker.html.twig'
s5bab8a989fa81[fechaDesde]:26 sep. 2018
s5bab8a989fa81[fechaHasta]:27 oct. 2018
s5bab8a989fa81[fechaFinProhibicion]:1 dic. 2018
FechaDesde :
FechaHasta :DateTime Object ( [date] => 2018-10-26 23:00:00.000000 [timezone_type] => 3 [timezone] => America/Sao_Paulo )
FechaFinProhibicion :DateTime Object ( [date] => 2018-12-01 00:00:00.000000 [timezone_type] => 3 [timezone] => America/Sao_Paulo )
Following this conversation: #319 (comment)
It would be nice to also narrow the types for the form options, otherwise we are coding thing expecting some types that might not be true.
Composer or BlockAdmin does not show help messages in forms.
This does not work in 3.x either. It does work if the help is defined in subformType. for example I have CollertionType form inside ImmutableArrayType and with add it loads the subformType.
$ composer show --latest 'sonata-project/*'
Direct dependencies required in composer.json:
sonata-project/admin-bundle 4.22.4 4.22.4 The missing Symfony Admin Generator
sonata-project/doctrine-orm-admin-bundle 4.9.1 4.9.1 Integrate Doctrine ORM into the SonataAdminBundle
Transitive dependencies not required in composer.json:
sonata-project/block-bundle 4.19.0 4.19.0 Symfony SonataBlockBundle
sonata-project/doctrine-extensions 2.1.0 2.1.0 Doctrine2 behavioral extensions
sonata-project/exporter 3.1.1 3.1.1 Lightweight Exporter library
sonata-project/form-extensions 1.18.0 1.18.0 Symfony form extensions
sonata-project/twig-extensions 2.0.0 2.0.0 Sonata twig extensions
#374 updated moment
to the latest version, but 1.18.0 build does not contain the updated moment version, but the pervious one (2.29.3). See the built app.js.
#387 fixes the problem, but it never got a release.
moment.version
is 2.29.4
moment.version
is 2.29.3
$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle 4.12.0 4.12.0 The missing Symfony Admin Generator
sonata-project/block-bundle 4.13.0 4.13.0 Symfony SonataBlockBundle
sonata-project/cache 2.2.0 2.2.0 Cache library
Package sonata-project/cache is abandoned, you should avoid using it. No replacement was suggested.
sonata-project/doctrine-extensions 1.17.0 1.17.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 4.3.0 4.3.0 Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter 2.13.0 2.13.0 Lightweight Exporter library
sonata-project/form-extensions 1.17.0 1.17.0 Symfony form extensions
sonata-project/twig-extensions 1.10.0 1.10.0 Sonata twig extensions
$ composer show --latest 'symfony/*'
symfony/amqp-messenger v6.1.0 v6.1.0 Symfony AMQP extension Messenger Bridge
symfony/apache-pack v1.0.1 v1.0.1 A pack for Apache support in Symfony
symfony/asset v6.1.0 v6.1.0 Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/cache v6.1.1 v6.1.1 Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts v3.1.0 v3.1.0 Generic abstractions related to caching
symfony/config v6.1.0 v6.1.0 Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console v6.1.1 v6.1.1 Eases the creation of beautiful and testable command line interfaces
symfony/css-selector v6.1.0 v6.1.0 Converts CSS selectors to XPath expressions
symfony/debug-bundle v6.1.0 v6.1.0 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack fr...
symfony/dependency-injection v6.1.0 v6.1.0 Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts v3.1.0 v3.1.0 A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge v6.1.0 v6.1.0 Provides integration for Doctrine with various Symfony components
symfony/doctrine-messenger v6.1.1 v6.1.1 Symfony Doctrine Messenger Bridge
symfony/dom-crawler v6.1.0 v6.1.0 Eases DOM navigation for HTML and XML documents
symfony/dotenv v6.1.0 v6.1.0 Registers environment variables from a .env file
symfony/error-handler v6.1.0 v6.1.0 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v6.1.0 v6.1.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.1.0 v3.1.0 Generic abstractions related to dispatching event
symfony/expression-language v6.1.0 v6.1.0 Provides an engine that can compile and evaluate expressions
symfony/filesystem v6.1.0 v6.1.0 Provides basic utilities for the filesystem
symfony/finder v6.1.0 v6.1.0 Finds files and directories via an intuitive fluent interface
symfony/flex v2.2.2 v2.2.2 Composer plugin for Symfony
symfony/form v6.1.1 v6.1.1 Allows to easily create, process and reuse HTML forms
symfony/framework-bundle v6.1.1 v6.1.1 Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client v6.1.1 v6.1.1 Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts v3.1.0 v3.1.0 Generic abstractions related to HTTP clients
symfony/http-foundation v6.1.1 v6.1.1 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v6.1.1 v6.1.1 Provides a structured process for converting a Request into a Response
symfony/intl v6.1.0 v6.1.0 Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library
symfony/lock v6.1.1 v6.1.1 Creates and manages locks, a mechanism to provide exclusive access to a shared resource
symfony/mailer v6.1.1 v6.1.1 Helps sending emails
symfony/maker-bundle v1.43.0 v1.43.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/messenger v6.1.0 v6.1.0 Helps applications send and receive messages to/from other applications or via message queues
symfony/mime v6.1.1 v6.1.1 Allows manipulating MIME messages
symfony/monolog-bridge v6.1.1 v6.1.1 Provides integration for Monolog with various Symfony components
symfony/monolog-bundle v3.8.0 v3.8.0 Symfony MonologBundle
symfony/options-resolver v6.1.0 v6.1.0 Provides an improved replacement for the array_replace PHP function
symfony/password-hasher v6.1.0 v6.1.0 Provides password hashing utilities
symfony/phpunit-bridge v6.1.0 v6.1.0 Provides utilities for PHPUnit, especially user deprecation notices management
symfony/polyfill-ctype v1.26.0 v1.26.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme v1.26.0 v1.26.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu v1.26.0 v1.26.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.26.0 v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer v1.26.0 v1.26.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring v1.26.0 v1.26.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80 v1.26.0 v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process v6.1.0 v6.1.0 Executes commands in sub-processes
symfony/property-access v6.1.0 v6.1.0 Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info v6.1.1 v6.1.1 Extracts information about PHP class' properties using metadata of popular sources
symfony/proxy-manager-bridge v6.1.0 v6.1.0 Provides integration for ProxyManager with various Symfony components
symfony/psr-http-message-bridge v2.1.2 v2.1.2 PSR HTTP message bridge
symfony/rate-limiter v6.1.0 v6.1.0 Provides a Token Bucket implementation to rate limit input and output in your application
symfony/routing v6.1.1 v6.1.1 Maps an HTTP request to a set of configuration variables
symfony/runtime v6.1.1 v6.1.1 Enables decoupling PHP applications from global state
symfony/security-acl v3.3.1 v3.3.1 Symfony Security Component - ACL (Access Control List)
symfony/security-bundle v6.1.0 v6.1.0 Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core v6.1.0 v6.1.0 Symfony Security Component - Core Library
symfony/security-csrf v6.1.0 v6.1.0 Symfony Security Component - CSRF Library
symfony/security-http v6.1.1 v6.1.1 Symfony Security Component - HTTP Integration
symfony/serializer v6.1.1 v6.1.1 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/service-contracts v3.1.0 v3.1.0 Generic abstractions related to writing services
symfony/stopwatch v6.1.0 v6.1.0 Provides a way to profile code
symfony/string v6.1.0 v6.1.0 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/templating v6.1.0 v6.1.0 Provides all the tools needed to build any kind of template system
symfony/translation v6.1.0 v6.1.0 Provides tools to internationalize your application
symfony/translation-contracts v3.1.0 v3.1.0 Generic abstractions related to translation
symfony/twig-bridge v6.1.0 v6.1.0 Provides integration for Twig with various Symfony components
symfony/twig-bundle v6.1.1 v6.1.1 Provides a tight integration of Twig into the Symfony full-stack framework
symfony/validator v6.1.1 v6.1.1 Provides tools to validate values
symfony/var-dumper v6.1.0 v6.1.0 Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter v6.1.1 v6.1.1 Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-link v6.1.0 v6.1.0 Manages links between resources
symfony/web-profiler-bundle v6.1.1 v6.1.1 Provides a development tool that gives detailed information about the execution of any request
symfony/yaml v6.1.0 v6.1.0 Loads and dumps YAML files
$ php -v
PHP 8.1.4 (cli) (built: Apr 4 2022 13:30:17) (NTS)
Company entity:
declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Stringable;
use Symfony\Component\Validator\Constraints as Validator;
#[ORM\Entity]
#[ORM\Table(name: 'company')]
class Company implements Stringable
{
/**
* @var int|null
*/
#[ORM\Column(name: 'id', type: Types::INTEGER, options: ['unsigned' => true])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private ?int $id = null;
/**
* @var string
*/
#[ORM\Column(name: 'name', type: Types::STRING, length: 192, unique: true)]
#[Validator\NotBlank]
private string $name;
/**
* @var Collection<int, Contact>
*/
#[ORM\OneToMany(mappedBy: 'company', targetEntity: Contact::class, cascade: ['persist'], orphanRemoval: true)]
#[Validator\Valid]
private Collection $contacts;
public function __construct()
{
$this->contacts = new ArrayCollection();
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param string $name
*
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param Contact $contact
*
* @return $this
*/
public function addContact(Contact $contact): self
{
$contact->setCompany($this);
$this->contacts->add($contact);
return $this;
}
/**
* @param Contact $contact
*/
public function removeContact(Contact $contact): void
{
$this->contacts->removeElement($contact);
}
public function clearContacts(): void
{
$this->contacts->clear();
}
/**
* @return Collection<int, Contact>
*/
public function getContacts(): Collection
{
return $this->contacts;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->getName();
}
}
Contact entity (related with ManyToOne to Company)
declare(strict_types=1);
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Stringable;
use Symfony\Component\Validator\Constraints as Validator;
#[ORM\Entity]
#[ORM\Table(name: 'contact')]
class Contact implements Stringable
{
/**
* @var int|null
*/
#[ORM\Column(name: 'id', type: Types::INTEGER, options: ['unsigned' => true])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private ?int $id = null;
/**
* @var Company
*/
#[ORM\ManyToOne(targetEntity: Company::class, inversedBy: 'contacts')]
#[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id', nullable: false)]
private Company $company;
/**
* @var string
*/
#[ORM\Column(name: 'name', type: Types::STRING, length: 192, nullable: false)]
#[Validator\NotBlank]
private string $name;
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param Company $company
*
* @return $this
*/
public function setCompany(Company $company): self
{
$this->company = $company;
return $this;
}
/**
* @return Company
*/
public function getCompany(): Company
{
return $this->company;
}
/**
* @param string $name
*
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->getName();
}
}
Contact Admin:
declare(strict_types=1);
namespace App\Admin;
use App\Entity\Contact;
use App\Translator\AdminTranslator;
use Sonata\AdminBundle\Form\FormMapper;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('sonata.admin', [
'manager_type' => 'orm',
'model_class' => Contact::class,
'label_translator_strategy' => AdminTranslator::class,
])]
final class ContactAdmin extends AbstractAdmin
{
/**
* @var array
*/
protected array $removeRoutes = ['delete', 'show'];
/**
* @inheritDoc
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->add('name', null, [
'required' => true,
]);
}
}
Company Admin:
<?php
declare(strict_types=1);
namespace App\Admin;
use App\Entity\Company;
use App\Translator\AdminTranslator;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\FieldDescription\FieldDescriptionInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\DoctrineORMAdminBundle\Filter\ChoiceFilter;
use Sonata\Form\Type\CollectionType;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
#[AutoconfigureTag('sonata.admin', [
'manager_type' => 'orm',
'model_class' => Company::class,
'label' => 'Company',
'label_translator_strategy' => AdminTranslator::class,
])]
final class CompanyAdmin extends AbstractAdmin
{
/**
* @var array
*/
protected array $removeRoutes = ['delete'];
/**
* @inheritDoc
*/
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper
->tab('tab1')
->with('tab1_block1')
->add('name', null, [
'required' => true,
])
->add('contacts', CollectionType::class, [
'required' => false,
], ['edit' => 'inline', 'inline' => 'table'])
->end()
->end();
}
/**
* @inheritDoc
*/
protected function configureListFields(ListMapper $listMapper): void
{
$listMapper
->add('name')
->add(ListMapper::NAME_ACTIONS, null, [
'actions' => [
'show' => [],
'edit' => [],
'delete' => [],
],
]);
}
}
If I click "Edit" or "Create new" company and press "Add new", to add a related contact entity, I get the error "Symfony\Component\Form\Form::remove(): Argument #1 ($name) must be of type string, int given, called in /data/vendor/sonata-project/form-extensions/src/EventListener/ResizeFormListener.php on line 92"
The problem started in 0898fa7, where the type cast is removed.
Allow to insert new "Contact".
I get a PHP TypeError.
This does now work when webpack is used as jQuery is not available without extra config.
We can deprecate passing an array and change the parameter type to string
in 2.0.
form-extensions/src/Validator/ErrorElement.php
Lines 195 to 208 in 5097901
Example of usage :
protected function configureFormFields(FormMapper $formMapper): void
{
$formMapper->add('contactInfo', NestedFieldsType::class, [
'subfields' => [
[
'items', CollectionType::class, [
'subfields' => [
['title', TextType::class],
['image', ModelListType::class, ['link_parameters' => ['context' => 'post_thumbnail']]],
]
]
],
['group', GroupType::class, [
'subfields' => [
['title', TextType::class],
['image', ModelListType::class, ['link_parameters' => ['context' => 'post_thumbnail']],
]
]
],
],
['title', TextType::class],
['content', CKEditorType::class],
]]);
}
Example of resulting json:
{
"items": [
{
"title": "Test",
"image": "image.png"
},
{
"title": "Test 2",
"image": "image.png"
},
{
"title": "Test 3",
"image": "image.png"
}
],
"group": {
"title": "Test",
"image": "image.png"
},
"title": "Test",
"content": "<p>Test <strong>Bold</strong></p>"
}
Since we're deprecating the API on every sonata project (and the JMS usage), we should deprecate the JMS usage on this library and remove the dependency in the next major.
Which mean deprecating:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.