55namespace Webonaute \DoctrineDataLockingBundle \Entity ;
66
77use DateTime ;
8+ use DateTimeImmutable ;
9+ use DateTimeInterface ;
810use Doctrine \ORM \Mapping as ORM ;
911
1012/**
1113 * !!! You should put a index on at least the lockId and lockState.
12- *
13- * @ORM\Embeddable
1414 */
15+ #[ORM \Embeddable]
1516class ProcessLock
1617{
17- /**
18- * @var string
19- *
20- * @ORM\Column(type="string", length=40, nullable=true)
21- */
22- private $ lockId ;
18+ #[ORM \Column(type: 'string ' , length: 40 , nullable: true )]
19+ private ?string $ lockId = null ;
2320
24- /**
25- * @var string
26- *
27- * @ORM\Column(type="string", length=40, nullable=true)
28- */
29- private $ lockState ;
21+ #[ORM \Column(type: 'string ' , length: 40 , nullable: true )]
22+ private ?string $ lockState = null ;
3023
3124 /**
32- * @var DateTime
33- *
34- * @ORM\Column(type="datetime", nullable=true)
25+ * @var \DateTime|DateTimeImmutable|null
3526 */
36- private $ lockedAt ;
27+ #[ORM \Column(type: 'datetime ' , nullable: true )]
28+ private ?DateTimeInterface $ lockedAt = null ;
3729
3830 /**
3931 * Prevent locking before this date.
4032 *
41- * @var DateTime
42- *
43- * @ORM\Column(name="lockingAt", type="datetime", nullable=true)
33+ * @var \DateTime|DateTimeImmutable|null
4434 */
45- private $ lockingAt ;
35+ #[ORM \Column(name: 'lockingAt ' , type: 'datetime ' , nullable: true )]
36+ private ?DateTimeInterface $ lockingAt = null ;
4637
47- /**
48- * @return null|string
49- */
5038 public function getLockId (): ?string
5139 {
5240 return $ this ->lockId ;
@@ -61,17 +49,17 @@ public function setLockId(?string $lockId): void
6149 }
6250
6351 /**
64- * @return null| DateTime
52+ * @return \ DateTime|DateTimeImmutable|null
6553 */
66- public function getLockedAt (): ?DateTime
54+ public function getLockedAt (): ?DateTimeInterface
6755 {
6856 return $ this ->lockedAt ;
6957 }
7058
7159 /**
7260 * @param DateTime $lockedAt
7361 */
74- public function setLockedAt (?DateTime $ lockedAt ): void
62+ public function setLockedAt (?DateTimeInterface $ lockedAt ): void
7563 {
7664 $ this ->lockedAt = $ lockedAt ;
7765 }
@@ -93,17 +81,17 @@ public function setLockState($lockState): void
9381 }
9482
9583 /**
96- * @return null| DateTime
84+ * @return \ DateTime|DateTimeImmutable|null
9785 */
98- public function getLockingAt (): ?DateTime
86+ public function getLockingAt (): ?DateTimeInterface
9987 {
10088 return $ this ->lockingAt ;
10189 }
10290
10391 /**
104- * @param null| DateTime $lockingAt
92+ * @param \ DateTime|DateTimeImmutable|null $lockingAt
10593 */
106- public function setLockingAt (?DateTime $ lockingAt ): void
94+ public function setLockingAt (?DateTimeInterface $ lockingAt ): void
10795 {
10896 $ this ->lockingAt = $ lockingAt ;
10997 }
0 commit comments