@@ -770,11 +770,11 @@ public function insert($data = null, bool $returnID = true)
770
770
// Set created_at and updated_at with same time
771
771
$ date = $ this ->setDate ();
772
772
773
- if ($ this ->useTimestamps && $ this ->createdField && ! array_key_exists ($ this ->createdField , $ data )) {
773
+ if ($ this ->useTimestamps && $ this ->createdField !== '' && ! array_key_exists ($ this ->createdField , $ data )) {
774
774
$ data [$ this ->createdField ] = $ date ;
775
775
}
776
776
777
- if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , $ data )) {
777
+ if ($ this ->useTimestamps && $ this ->updatedField !== '' && ! array_key_exists ($ this ->updatedField , $ data )) {
778
778
$ data [$ this ->updatedField ] = $ date ;
779
779
}
780
780
@@ -857,11 +857,11 @@ public function insertBatch(?array $set = null, ?bool $escape = null, int $batch
857
857
// Set created_at and updated_at with same time
858
858
$ date = $ this ->setDate ();
859
859
860
- if ($ this ->useTimestamps && $ this ->createdField && ! array_key_exists ($ this ->createdField , $ row )) {
860
+ if ($ this ->useTimestamps && $ this ->createdField !== '' && ! array_key_exists ($ this ->createdField , $ row )) {
861
861
$ row [$ this ->createdField ] = $ date ;
862
862
}
863
863
864
- if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , $ row )) {
864
+ if ($ this ->useTimestamps && $ this ->updatedField !== '' && ! array_key_exists ($ this ->updatedField , $ row )) {
865
865
$ row [$ this ->updatedField ] = $ date ;
866
866
}
867
867
}
@@ -929,7 +929,7 @@ public function update($id = null, $data = null): bool
929
929
throw DataException::forEmptyDataset ('update ' );
930
930
}
931
931
932
- if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , $ data )) {
932
+ if ($ this ->useTimestamps && $ this ->updatedField !== '' && ! array_key_exists ($ this ->updatedField , $ data )) {
933
933
$ data [$ this ->updatedField ] = $ this ->setDate ();
934
934
}
935
935
@@ -1014,7 +1014,7 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
1014
1014
$ row [$ index ] = $ updateIndex ;
1015
1015
}
1016
1016
1017
- if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , $ row )) {
1017
+ if ($ this ->useTimestamps && $ this ->updatedField !== '' && ! array_key_exists ($ this ->updatedField , $ row )) {
1018
1018
$ row [$ this ->updatedField ] = $ this ->setDate ();
1019
1019
}
1020
1020
}
@@ -1147,7 +1147,7 @@ public function replace(?array $data = null, bool $returnSQL = false)
1147
1147
return false ;
1148
1148
}
1149
1149
1150
- if ($ this ->useTimestamps && $ this ->updatedField && ! array_key_exists ($ this ->updatedField , (array ) $ data )) {
1150
+ if ($ this ->useTimestamps && $ this ->updatedField !== '' && ! array_key_exists ($ this ->updatedField , (array ) $ data )) {
1151
1151
$ data [$ this ->updatedField ] = $ this ->setDate ();
1152
1152
}
1153
1153
0 commit comments