8
8
use ApiPlatform \Core \Bridge \Doctrine \Orm \Filter \OrderFilter ;
9
9
use ApiPlatform \Core \Bridge \Doctrine \Orm \Filter \SearchFilter ;
10
10
use ApiPlatform \Core \Serializer \Filter \PropertyFilter ;
11
+ use DateTimeInterface ;
12
+ use DateTime ;
11
13
use Doctrine \ORM \Mapping as ORM ;
12
14
use Exception ;
13
15
use Symfony \Component \Serializer \Annotation \Groups ;
14
16
use Symfony \Component \Serializer \Annotation \MaxDepth ;
15
17
use Symfony \Component \Validator \Constraints as Assert ;
16
- use \DateTime ;
17
18
18
19
/**
19
20
* @ApiResource(
@@ -122,9 +123,9 @@ class Loan implements LibraryInterface
122
123
* @Assert\DateTime()
123
124
* @Assert\NotBlank()
124
125
*
125
- * @var DateTime
126
+ * @var DateTimeInterface
126
127
*/
127
- protected DateTime $ startLoan ;
128
+ protected DateTimeInterface $ startLoan ;
128
129
129
130
/**
130
131
* @Groups({"loan:read", "loan:write"})
@@ -134,9 +135,9 @@ class Loan implements LibraryInterface
134
135
* @Assert\DateTime()
135
136
* @Assert\Blank()
136
137
*
137
- * @var DateTime |null
138
+ * @var DateTimeInterface |null
138
139
*/
139
- protected ?DateTime $ endLoan ;
140
+ protected ?DateTimeInterface $ endLoan ;
140
141
141
142
/**
142
143
* Loan constructor.
@@ -212,7 +213,7 @@ public function setBorrower(Reader $reader, bool $updateRelation = true): self
212
213
$ this ->borrower = $ reader ;
213
214
214
215
if ($ updateRelation ) {
215
- $ this ->borrower ->addLoan ($ this , false );
216
+ $ this ->borrower ->addBorrow ($ this , false );
216
217
}
217
218
218
219
return $ this ;
@@ -243,37 +244,37 @@ public function setLoaner(Reader $reader, bool $updateRelation = true): self
243
244
}
244
245
245
246
/**
246
- * @return DateTime |null
247
+ * @return DateTimeInterface |null
247
248
*/
248
- public function getStartLoan (): ?DateTime
249
+ public function getStartLoan (): ?DateTimeInterface
249
250
{
250
251
return $ this ->startLoan ;
251
252
}
252
253
253
254
/**
254
- * @param DateTime $startLoan
255
+ * @param DateTimeInterface $startLoan
255
256
* @return self
256
257
*/
257
- public function setStartLoan (DateTime $ startLoan ): self
258
+ public function setStartLoan (DateTimeInterface $ startLoan ): self
258
259
{
259
260
$ this ->startLoan = $ startLoan ;
260
261
261
262
return $ this ;
262
263
}
263
264
264
265
/**
265
- * @return DateTime |null
266
+ * @return DateTimeInterface |null
266
267
*/
267
- public function getEndLoan (): ?DateTime
268
+ public function getEndLoan (): ?DateTimeInterface
268
269
{
269
270
return $ this ->endLoan ;
270
271
}
271
272
272
273
/**
273
- * @param DateTime $endLoan
274
+ * @param DateTimeInterface $endLoan
274
275
* @return Loan
275
276
*/
276
- public function setEndLoan (DateTime $ endLoan ): self
277
+ public function setEndLoan (DateTimeInterface $ endLoan ): self
277
278
{
278
279
$ this ->endLoan = $ endLoan ;
279
280
0 commit comments