feature #26073 [DoctrineBridge] Add support for datetime immutable types in doctrine type guesser (jvasseur)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[DoctrineBridge] Add support for datetime immutable types in doctrine type guesser

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Add support for datetime immutable types in doctrine type guesser now that we support `DateTimeImmutable` input in the form component.

Commits
-------

8c94fef7f2 Add support for immutable types in doctrine type guesser
This commit is contained in:
Fabien Potencier 2018-02-12 07:58:34 +01:00
commit 5bc2753182
2 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
4.1.0
-----
* added support for datetime immutable types in form type guesser
4.0.0
-----

View File

@ -60,12 +60,19 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
case Type::DATETIMETZ:
case 'vardatetime':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', array(), Guess::HIGH_CONFIDENCE);
case 'datetime_immutable';
case 'datetimetz_immutable';
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', array('input' => 'datetime_immutable'), Guess::HIGH_CONFIDENCE);
case 'dateinterval':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateIntervalType', array(), Guess::HIGH_CONFIDENCE);
case Type::DATE:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', array(), Guess::HIGH_CONFIDENCE);
case 'date_immutable':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', array('input' => 'datetime_immutable'), Guess::HIGH_CONFIDENCE);
case Type::TIME:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', array(), Guess::HIGH_CONFIDENCE);
case 'time_immutable'
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', array('input' => 'datetime_immutable'), Guess::HIGH_CONFIDENCE);
case Type::DECIMAL:
case Type::FLOAT:
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', array(), Guess::MEDIUM_CONFIDENCE);