Skip to content

Commit 9aa7f65

Browse files
fix: dateTime resolving (#393)
1 parent 3da7653 commit 9aa7f65

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/AttributeGenerator/DoctrineOrmAttributeGenerator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ public function generatePropertyAttributes(Property $property, string $className
108108
case 'time':
109109
$type = 'time';
110110
break;
111-
case 'dateTime':
111+
case 'date':
112112
$type = 'date';
113113
break;
114+
case 'dateTime':
115+
$type = 'datetime';
116+
break;
114117
default:
115118
$type = $phpType;
116119
switch ($phpType) {
@@ -124,7 +127,7 @@ public function generatePropertyAttributes(Property $property, string $className
124127
$type = 'text';
125128
break;
126129
case '\\'.\DateTimeInterface::class:
127-
$type = 'date';
130+
$type = 'datetime';
128131
break;
129132
case '\\'.\DateInterval::class:
130133
$type = 'string';

tests/e2e/original/App/OpenApi/Entity/Book.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Book
7676
*
7777
* @see https://schema.org/dateCreated
7878
*/
79-
#[ORM\Column(type: 'date')]
79+
#[ORM\Column(type: 'datetime')]
8080
#[ApiProperty(types: ['https://schema.org/dateCreated'])]
8181
#[Assert\Type(\DateTimeInterface::class)]
8282
#[Assert\NotNull]
@@ -101,7 +101,7 @@ class Book
101101
#[ApiProperty]
102102
private ?string $cover = null;
103103

104-
#[ORM\Column(type: 'date', nullable: true)]
104+
#[ORM\Column(type: 'datetime', nullable: true)]
105105
#[ApiProperty]
106106
#[Assert\Type(\DateTimeInterface::class)]
107107
private ?\DateTimeInterface $archivedAt = null;

tests/e2e/original/App/OpenApi/Entity/Order.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Order
3333
#[Assert\NotNull]
3434
private int $quantity;
3535

36-
#[ORM\Column(type: 'date')]
36+
#[ORM\Column(type: 'datetime')]
3737
#[ApiProperty]
3838
#[Assert\Type(\DateTimeInterface::class)]
3939
#[Assert\NotNull]

tests/e2e/original/App/OpenApi/Entity/Review.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Review
7878
/**
7979
* Publication date of the review.
8080
*/
81-
#[ORM\Column(type: 'date', nullable: true)]
81+
#[ORM\Column(type: 'datetime', nullable: true)]
8282
#[ApiProperty]
8383
#[Assert\Type(\DateTimeInterface::class)]
8484
private ?\DateTimeInterface $publicationDate = null;

0 commit comments

Comments
 (0)