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/Bridge/Doctrine
Fabien Potencier 4e32643bdf feature #31528 [Validator] Add a Length::$allowEmptyString option to reject empty strings (ogizanagi)
This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Add a Length::$allowEmptyString option to reject empty strings

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | Todo (change the warning on top of https://symfony.com/doc/current/reference/constraints/Length.html)

which defaults to `true` in 4.4 but will trigger a deprecation if not set explicitly
in order to make the default `false` in 5.0.

While it could be solved now thanks to #29641 by using both `@Length(min=1)` & `@NotBlank(allowNull=true)` constraints,
as expressed in https://github.com/symfony/symfony/issues/27876#issuecomment-403307783 and following comments, the `@Length(min=1)` behavior doesn't match our expectations when reading it: it feels logical to invalidate empty strings, but it actually doesn't.
Hence the proposal of making the behavior of rejecting empty strings the default in 5.0.

In my opinion, the flag could even be removed later.

Commits
-------

e113e7f812 [Validator] Add a Length::$allowEmptyString option to reject empty strings
2019-07-03 15:15:57 +02:00
..
CacheWarmer [DI] minor docblock fixes 2017-10-24 13:40:19 +02:00
DataCollector Merge branch '3.4' into 4.2 2019-06-26 08:46:55 +02:00
DataFixtures [DI] minor docblock fixes 2017-10-24 13:40:19 +02:00
DependencyInjection Merge branch '3.4' into 4.2 2019-02-23 16:17:42 +01:00
Form [DoctrineBridge] Deprecated using IdReader when optimization is not possible 2019-04-07 15:30:06 +02:00
Logger switched array() to [] 2019-01-16 10:39:14 +01:00
Messenger removed @experimental annotations 2019-06-29 18:43:50 +02:00
PropertyInfo [Doctrine][PropertyInfo] Detect if the ID is writeable 2019-05-12 22:41:45 +02:00
Security Merge branch '3.4' into 4.2 2019-02-23 16:17:42 +01:00
Test Merge branch '4.2' into 4.3 2019-06-13 13:01:17 +02:00
Tests feature #31528 [Validator] Add a Length::$allowEmptyString option to reject empty strings (ogizanagi) 2019-07-03 15:15:57 +02:00
Validator Merge branch '4.2' into 4.3 2019-06-13 13:01:17 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md Add clear Entity Manager middleware (closes #29662) 2019-06-03 18:44:42 +03:00
composer.json Allow Symfony 5.0 2019-05-28 17:53:17 +02:00
ContainerAwareEventManager.php Respect parent class contract in ContainerAwareDoctrineEventManager 2019-05-15 21:39:23 +03:00
LICENSE update year in license files 2019-01-01 14:45:19 +01:00
ManagerRegistry.php [DoctrineBridge] [DX] Update exception text in ManagerRegistry::resetService to avoid confusion. 2019-04-15 11:42:18 +02:00
phpunit.xml.dist Bump phpunit XSD version to 5.2 2018-11-11 12:18:13 +01:00
README.md Updated all the README files 2016-03-04 08:12:06 +01:00
RegistryInterface.php Fixed minor typos 2018-12-28 12:28:01 +01:00

Doctrine Bridge

Provides integration for Doctrine with various Symfony components.

Resources