Skip to content

Commit

Permalink
use datetime imutable instead of db expression
Browse files Browse the repository at this point in the history
  • Loading branch information
eluhr committed Jan 4, 2024
1 parent 56cb77f commit 8850223
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/generators/model/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ protected function generateTimestamp($table)
// check column type, if datetime set NOW() as Value
if ($table->getColumn($this->createdAtColumn)->type === 'datetime') {
return [
'value' => 'new \yii\db\Expression(\'NOW()\')',
'value' => '(new \DateTime())->format(\'Y-m-d H:i:s\')',
'createdAtAttribute' => $createdAt,
'updatedAtAttribute' => $updatedAt,
'timestampBehaviorClass' => $this->timestampBehaviorClass,
Expand Down

0 comments on commit 8850223

Please sign in to comment.