This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Form
Tobias Schultze 140ed985be feature #16747 [Form] Improved performance of ChoiceType and its subtypes (webmozart)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Improved performance of ChoiceType and its subtypes

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I found out today that, although CachingFactoryDecorator is part of Symfony 2.7, it is not configured to be used in the DI configuration. This simple in-memory cache improved the page load by 50% for one considerably large form with many (~600) choice/entity fields that I was working on today.

Also, caching of query builders with parameters was broken, since the parameters are represented by objects. PHP's object hashes were used to calculate the cache keys, hence the cache always missed. I converted parameters to arrays for calculating the cache keys to fix this problem.

Commits
-------

a0ef101 [Form] Improved performance of ChoiceType and its subtypes
2015-12-30 16:04:43 +01:00
..
ChoiceList [Form] Deprecated setting "choices_as_values" to "false" 2015-11-27 10:37:24 +01:00
Deprecated fixes CS 2015-08-24 09:13:45 +02:00
Exception Silence invasive deprecation warnings, opt-in for warnings 2015-06-08 10:37:21 +01:00
Extension feature #16747 [Form] Improved performance of ChoiceType and its subtypes (webmozart) 2015-12-30 16:04:43 +01:00
Guess [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
Resources Merge branch '2.3' into 2.7 2015-11-27 06:41:56 +01:00
Test Merge branch '2.3' into 2.6 2015-03-24 18:00:37 +01:00
Tests [Form] fix Catchable Fatal Error if choices is not an array 2015-12-30 10:03:36 +01:00
Util Silence invasive deprecation warnings, opt-in for warnings 2015-06-08 10:37:21 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
AbstractExtension.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
AbstractRendererEngine.php [2.3] [Config] [Console] [DependencyInjection] [DomCrawler] [Form] [HttpKernel] [PropertyAccess] [Security] [Translation] [Yaml] static code analysis, code cleanup 2015-03-07 08:38:01 +01:00
AbstractType.php fixed CS 2015-06-11 21:09:58 +02:00
AbstractTypeExtension.php fixed CS 2015-06-11 21:09:58 +02:00
Button.php fixes CS 2015-08-24 09:13:45 +02:00
ButtonBuilder.php Merge branch '2.6' into 2.7 2015-07-22 12:11:00 +02:00
ButtonTypeInterface.php [Form] Implemented support for buttons 2013-04-13 16:46:28 +02:00
CallbackTransformer.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
CHANGELOG.md [Form][choice] added choice_translation_domain to avoid trans options. 2015-04-03 23:13:58 +01:00
ClickableInterface.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
composer.json Merge branch '2.3' into 2.7 2015-10-30 13:10:21 -07:00
DataMapperInterface.php [Form] Moved parent data inheritance from data mappers to Form 2013-04-19 10:09:37 +02:00
DataTransformerInterface.php Merge branch '2.2' 2013-05-06 22:03:44 +02:00
Form.php [Form] Disabled view data validation if "data_class" is set to null 2015-11-26 10:11:54 +01:00
FormBuilder.php Check instance of FormBuilderInterface instead of FormBuilder 2015-05-21 18:12:55 -03:00
FormBuilderInterface.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
FormConfigBuilder.php Merge branch '2.3' into 2.7 2015-09-27 12:08:38 +02:00
FormConfigBuilderInterface.php Docblock fixes 2014-11-30 13:33:44 +00:00
FormConfigInterface.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
FormError.php Merge branch '2.3' into 2.5 2014-12-22 17:29:52 +01:00
FormErrorIterator.php fixes CS 2015-08-24 09:13:45 +02:00
FormEvent.php [Form] removed deprecated methods and classes 2013-03-23 11:48:19 +01:00
FormEvents.php Merge branch '2.6' into 2.7 2015-05-02 17:21:08 +02:00
FormExtensionInterface.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
FormFactory.php [Form] fixed a maxlength overring on a guessing 2014-12-12 08:47:01 +01:00
FormFactoryBuilder.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
FormFactoryBuilderInterface.php [Form] fix and unify phpdoc 2013-10-31 15:15:49 +01:00
FormFactoryInterface.php fixed types in phpdocs 2014-04-16 08:51:57 +02:00
FormInterface.php Merge branch '2.5' into 2.6 2014-12-05 13:00:15 +01:00
FormRegistry.php [Form] remove validation of FormRegistry::getType as FormRegistry::hasType does not validate either 2015-10-22 02:46:43 +02:00
FormRegistryInterface.php [Form] remove validation of FormRegistry::getType as FormRegistry::hasType does not validate either 2015-10-22 02:46:43 +02:00
FormRenderer.php Merge branch '2.3' into 2.6 2015-03-07 08:40:15 +01:00
FormRendererEngineInterface.php Docblock fixes 2014-11-30 13:33:44 +00:00
FormRendererInterface.php Merge branch '2.3' into 2.4 2014-07-15 16:07:10 +02:00
Forms.php [2.5] cleanup deprecated uses 2015-01-05 09:51:41 +01:00
FormTypeExtensionInterface.php [Form] Cleanup deprecation notices 2015-04-08 11:29:16 +02:00
FormTypeGuesserChain.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
FormTypeGuesserInterface.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
FormTypeInterface.php [Form] Cleanup deprecation notices 2015-04-08 11:29:16 +02:00
FormView.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
LICENSE Updated copyright to 2015 2015-01-01 13:56:52 +01:00
NativeRequestHandler.php [2.3] Fix @link annotations 2015-04-10 20:54:05 +02:00
phpunit.xml.dist Add missing exclusions from phpunit.xml.dist 2015-11-18 09:19:46 +01:00
PreloadedExtension.php fix CS 2015-07-05 16:01:47 +02:00
README.md Merge branch '2.3' into 2.7 2015-09-06 10:36:38 +02:00
RequestHandlerInterface.php [Form] Deprecated bind() and isBound() in favor of submit() and isSubmitted() 2013-04-20 18:05:58 +02:00
ResolvedFormType.php [Form] Fixed compatibility with FormTypeInterface implementations that don't extend AbstractType 2015-06-25 13:34:24 +02:00
ResolvedFormTypeFactory.php [Form] Fixed ResolvedFormType to really be replaceable 2012-07-29 19:13:45 +02:00
ResolvedFormTypeFactoryInterface.php [Form] fix and unify phpdoc 2013-10-31 15:15:49 +01:00
ResolvedFormTypeInterface.php [2.3][Form] Cleanup & fix phpdocs 2014-07-09 12:39:32 +02:00
ReversedTransformer.php [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
SubmitButton.php fixed types in phpdocs 2014-04-16 12:30:19 +02:00
SubmitButtonBuilder.php [Form] fix and unify phpdoc 2013-10-31 15:15:49 +01:00
SubmitButtonTypeInterface.php [Form] Implemented support for buttons 2013-04-13 16:46:28 +02:00

Form Component

Form provides tools for defining forms, rendering and mapping request data to related models. Furthermore it provides integration with the Validation component.

Resources

Silex integration:

https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/FormServiceProvider.php

Documentation:

https://symfony.com/doc/2.7/book/forms.html

Resources

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/Form/
$ composer install
$ phpunit