77
88class Index extends Resource
99{
10- protected static string $ timeStampFormatDb = 'Y-m-d H:i:s.v ' ;
1110 public const TYPE_UNIQUE = 'unique ' ;
1211
1312 public const TYPE_FULLTEXT = 'fulltext ' ;
1413
1514 public const TYPE_KEY = 'key ' ;
1615
17- protected string $ createdAt ;
18- protected string $ updatedAt ;
19-
2016 /**
2117 * @param string $id
2218 * @param string $key
@@ -25,7 +21,7 @@ class Index extends Resource
2521 * @param array<string> $attributes
2622 * @param array<int> $lengths
2723 * @param array<string> $orders
28- * @param string|null $createdAt
24+ * @param string $createdAt
2925 * @param string $updatedAt
3026 */
3127 public function __construct (
@@ -36,14 +32,10 @@ public function __construct(
3632 private readonly array $ attributes = [],
3733 private readonly array $ lengths = [],
3834 private readonly array $ orders = [],
39- ? string $ createdAt = null ,
40- ? string $ updatedAt = null ,
35+ protected string $ createdAt = "" ,
36+ protected string $ updatedAt = "" ,
4137 ) {
4238 $ this ->id = $ id ;
43- $ date = new \DateTime ();
44- $ now = $ date ->format (self ::$ timeStampFormatDb );
45- $ this ->$ createdAt = $ createdAt ?? $ now ;
46- $ this ->$ updatedAt = $ updatedAt ?? $ now ;
4739 }
4840
4941 /**
0 commit comments