diff --git a/src/Doctrine/EntityDetails.php b/src/Doctrine/EntityDetails.php index 03fdc27bf..76b44c383 100644 --- a/src/Doctrine/EntityDetails.php +++ b/src/Doctrine/EntityDetails.php @@ -13,6 +13,8 @@ use Doctrine\Persistence\Mapping\ClassMetadata; use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Bundle\MakerBundle\Tests\Doctrine\DoctrineHelperTest; +use Symfony\Component\Form\Extension\Core\Type\DateType; /** * @author Sadicov Vladimir @@ -61,6 +63,17 @@ public function getFormFields(): array $fieldsWithTypes[$field] = null; } + foreach ($this->metadata->fieldMappings as $fieldName => $fieldMapping) { + $propType = DoctrineHelper::getPropertyTypeForColumn($fieldMapping['type']); + if (($propType === '\\' . \DateTimeImmutable::class) || + ($propType === '\\' . \DateTimeInterface::class)) + { + $fieldsWithTypes[$fieldName] = [ + 'type' => null, + 'options_code' => "'widget' => 'single_text'" + ]; + } + } foreach ($this->metadata->associationMappings as $fieldName => $relation) { if (\Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_MANY === $relation['type']) { continue;