8000 feature #1392 [make:*] add `single_text` widget for all date types · symfony/maker-bundle@b0d2d5d · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0d2d5d

Browse files
authored
feature #1392 [make:*] add single_text widget for all date types
1 parent e44c1b2 commit b0d2d5d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Doctrine/EntityDetails.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ public function getFormFields(): array
6161
$fieldsWithTypes[$field] = null;
6262
}
6363

64+
foreach ($this->metadata->fieldMappings as $fieldName => $fieldMapping) {
65+
$propType = DoctrineHelper::getPropertyTypeForColumn($fieldMapping['type']);
66+
if (($propType === '\\'.\DateTimeImmutable::class)
67+
|| ($propType === '\\'.\DateTimeInterface::class)) {
68+
$fieldsWithTypes[$fieldName] = [
69+
'type' => null,
70+
'options_code' => "'widget' => 'single_text'",
71+
];
72+
}
73+
}
6474
foreach ($this->metadata->associationMappings as $fieldName => $relation) {
6575
if (\Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_MANY === $relation['type']) {
6676
continue;

0 commit comments

Comments
 (0)
0