@@ -27,17 +27,15 @@ class Job
2727
2828 protected int $ status = self ::STATUS_WAITING ;
2929 protected Configuration $ configuration ;
30- protected \DateTime $ startTime ;
31- protected \DateTime $ endTime ;
30+ protected ? \DateTime $ startTime = null ;
31+ protected ? \DateTime $ endTime = null ;
3232 protected \DateTime $ createdTime ;
3333 protected string $ error = '' ;
3434 protected int $ uid ;
3535
3636 public function __construct ()
3737 {
3838 $ this ->createdTime = new \DateTime ();
39- $ this ->startTime = new \DateTime ();
40- $ this ->endTime = new \DateTime ();
4139 }
4240
4341 public function fail (string $ error ): void
@@ -91,8 +89,8 @@ public function toDatabaseRow(): array
9189 'status ' => $ this ->status ,
9290 'json_configuration ' => $ json ,
9391 'created_time ' => $ this ->createdTime ->format ('U ' ),
94- 'start_time ' => $ this ->startTime -> format ('U ' ),
95- 'end_time ' => $ this ->endTime -> format ('U ' ),
92+ 'start_time ' => $ this ->startTime ? $ this -> startTime -> format ('U ' ) : 0 ,
93+ 'end_time ' => $ this ->endTime ? $ this -> endTime -> format ('U ' ): 0 ,
9694 'error ' => $ this ->error ,
9795 ];
9896 }
0 commit comments