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/Tests
Fabien Potencier bc8ee6f497 bug #12004 [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required (webmozart)
This PR was merged into the 2.3 branch.

Discussion
----------

[Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required

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

Consider the following entity:

```php
class Author
{
    /**
     * @Assert\NotBlank
     */
    private $name;

    private $age;
}
```

Right now, the "required" HTML attribute is set for both fields (since the default value of the "required" option is true). IMO this is wrong.

With this fix, the ValidatorTypeGuesser guesses `false` for the "required" option unless a NotNull/NotBlank constraint is present.

Commits
-------

fd77b09 [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required
2014-09-24 14:19:03 +02:00
..
Extension bug #12004 [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required (webmozart) 2014-09-24 14:19:03 +02:00
Fixtures unified return null usages 2014-04-16 09:43:51 +02:00
Guess fixed CS 2014-09-22 10:32:35 +02:00
Util [Form] Fixed Form::all() signature for PHP 5.3.3 2013-08-25 14:07:23 +02:00
AbstractDivLayoutTest.php fixed CS 2014-09-22 10:32:35 +02:00
AbstractExtensionTest.php moved component and bridge unit tests to the src/ directory 2012-03-29 08:37:22 +02:00
AbstractFormTest.php [Form] Fixed: submit() reacts to dynamic modifications of the form children 2013-08-22 13:20:04 +02:00
AbstractLayoutTest.php fixed CS 2014-09-22 10:32:35 +02:00
AbstractRequestHandlerTest.php [Form] Moved POST_MAX_SIZE validation from FormValidator to request handler 2014-09-23 14:27:03 +02:00
AbstractTableLayoutTest.php fixed CS 2014-09-22 10:32:35 +02:00
ButtonTest.php [Form] Added test for disabling buttons 2014-03-31 11:59:54 +02:00
CallbackTransformerTest.php fixed CS 2014-09-22 10:32:35 +02:00
CompoundFormPerformanceTest.php Moved FormIntegrationTestCase and FormPerformanceTestCase to the Test namespace 2013-04-19 14:44:07 +02:00
CompoundFormTest.php fixed CS 2014-09-22 10:32:35 +02:00
FormBuilderTest.php [Form] Make exception handling consistent with other components 2013-04-20 00:34:27 +03:00
FormConfigTest.php [Form] Renamed form processors to request handlers 2013-04-20 17:36:19 +02:00
FormFactoryBuilderTest.php fixed various inconsistencies 2014-02-11 11:29:24 +01:00
FormFactoryTest.php fixed @expectedException class names 2013-11-25 09:44:14 +01:00
FormIntegrationTestCase.php Moved FormIntegrationTestCase and FormPerformanceTestCase to the Test namespace 2013-04-19 14:44:07 +02:00
FormPerformanceTestCase.php Moved FormIntegrationTestCase and FormPerformanceTestCase to the Test namespace 2013-04-19 14:44:07 +02:00
FormRegistryTest.php [Form] Make exception handling consistent with other components 2013-04-20 00:34:27 +03:00
FormRendererTest.php fixes PSR-0 issues in tests 2013-12-30 22:13:42 +01:00
NativeRequestHandlerTest.php [Form] Moved POST_MAX_SIZE validation from FormValidator to request handler 2014-09-23 14:27:03 +02:00
ResolvedFormTypeTest.php [Form] Removed deprecated code scheduled for removal in 2.3 2013-04-13 16:46:29 +02:00
SimpleFormTest.php fixed CS 2014-09-22 10:32:35 +02:00