Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Apr 15, 2024
1 parent ac590b4 commit 96e33a9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/base/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ public function behaviors()
if (self::safeGetTableSchema() && self::safeGetTableSchema()->getColumn('created_at') && self::safeGetTableSchema()->getColumn('updated_at')) {
$result[TimestampBehavior::class] = [
'class' => TimestampBehavior::class,
'preserveNonEmptyValues' => true,
/*'value' => function () {
return date('U');
},*/
];
} elseif (self::safeGetTableSchema() && self::safeGetTableSchema()->getColumn('created_at')) {
$result[TimestampBehavior::class] = [
'class' => TimestampBehavior::class,
'preserveNonEmptyValues' => true,
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => [],
Expand All @@ -143,6 +145,7 @@ public function behaviors()
} elseif (self::safeGetTableSchema() && self::safeGetTableSchema()->getColumn('updated_at')) {
$result[TimestampBehavior::class] = [
'class' => TimestampBehavior::class,
'preserveNonEmptyValues' => true,
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
Expand Down

0 comments on commit 96e33a9

Please sign in to comment.