feature #24297 Feature/doctrine type guesser simple json array support (iluuu1994)

This PR was squashed before being merged into the 4.2-dev branch (closes #24297).

Discussion
----------

Feature/doctrine type guesser simple json array support

Symfony currently supports doctrine/dbal ~2.4 which has support for both `simple_array` and `json_array`:

44cd77f022
2d183acdf0

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

There's technically a small BC break since `simple_array` and `json_array` fields would've been displayed as simple text fields. Is this an acceptable BC break for Symfony 3.4?

Commits
-------

524bc4b039 Feature/doctrine type guesser simple json array support
This commit is contained in:
Fabien Potencier 2018-09-04 18:49:00 +02:00
commit 2ea27cd211
2 changed files with 2 additions and 0 deletions

View File

@ -6,6 +6,7 @@ CHANGELOG
* deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor`,
an instance of `EntityManagerInterface` should be injected instead
* added support for `simple_array` type
4.1.0
-----

View File

@ -53,6 +53,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
switch ($metadata->getTypeOfField($property)) {
case Type::TARRAY:
case Type::SIMPLE_ARRAY:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), Guess::MEDIUM_CONFIDENCE);
case Type::BOOLEAN:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', array(), Guess::HIGH_CONFIDENCE);