File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Fixtures/TestBundle/Document Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 97
97
use ApiPlatform \Tests \Fixtures \TestBundle \Document \SoMany as SoManyDocument ;
98
98
use ApiPlatform \Tests \Fixtures \TestBundle \Document \Taxon as TaxonDocument ;
99
99
use ApiPlatform \Tests \Fixtures \TestBundle \Document \ThirdLevel as ThirdLevelDocument ;
100
+ use ApiPlatform \Tests \Fixtures \TestBundle \Document \TransformedDummyDocument ;
100
101
use ApiPlatform \Tests \Fixtures \TestBundle \Document \UrlEncodedId as UrlEncodedIdDocument ;
101
102
use ApiPlatform \Tests \Fixtures \TestBundle \Document \User as UserDocument ;
102
103
use ApiPlatform \Tests \Fixtures \TestBundle \Document \VideoGame as VideoGameDocument ;
@@ -2714,4 +2715,9 @@ private function buildLinkHandledDummy(string $slug): LinkHandledDummy|LinkHandl
2714
2715
{
2715
2716
return $ this ->isOrm () ? new LinkHandledDummy ($ slug ) : new LinkHandledDummyDocument ($ slug );
2716
2717
}
2718
+
2719
+ private function buildTransformedDummy (\DateTimeImmutable $ dateTime ): TransformedDummyEntity |TransformedDummyDocument
2720
+ {
2721
+ return $ this ->isOrm () ? new TransformedDummyEntity ($ dateTime ) : new TransformedDummyDocument ($ dateTime );
2722
+ }
2717
2723
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace ApiPlatform \Tests \Fixtures \TestBundle \Document ;
4
+
5
+ use Doctrine \DBAL \Types \Types ;
6
+ use Doctrine \ODM \MongoDB \Mapping \Annotations as ODM ;
7
+
8
+ class TransformedDummyDocument
9
+ {
10
+
11
+ #[ODM \Id(type: 'int ' , strategy: 'INCREMENT ' )]
12
+ private ?int $ id = null ;
13
+
14
+ #[ODM \Field(type: Types::DATETIME_IMMUTABLE )]
15
+ private \DateTimeInterface $ date ;
16
+
17
+ public function __construct (\DateTimeInterface $ date = null )
18
+ {
19
+ $ this ->setDate ($ date ?? new \DateTimeImmutable ());
20
+ }
21
+
22
+ public function getDate (): \DateTimeInterface
23
+ {
24
+ return $ this ->date ;
25
+ }
26
+
27
+ public function setDate (\DateTimeInterface $ date ): void
28
+ {
29
+ $ this ->date = $ date ;
30
+ }
31
+
32
+ public function getId (): ?int
33
+ {
34
+ return $ this ->id ;
35
+ }
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments