Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

leftovers from previous commit

  • Loading branch information...
commit aba2cdd31445cc0b6a49e4db2c98cbd7b0a5abf7 1 parent 433d238
@knut knut authored
Showing with 27 additions and 1 deletion.
  1. +13 −1 src/protected/models/Topic.php
  2. +14 −0 src/protected/models/User.php
View
14 src/protected/models/Topic.php
@@ -71,4 +71,16 @@ public function setSticky($value) {
$this->sticky = ($value == true) ? 1 : 0;
}
-}
+ protected function beforeSave() {
+ if(parent::beforeSave()) {
+ $now = date('Y-m-d H:i:s');
+ if($this->isNewRecord) {
+ $this->created_at = $now;
+ }
+ $this->updated_at = $now;
+ return true;
+ }
+ return false;
+ }
+
+}
View
14 src/protected/models/User.php
@@ -68,6 +68,20 @@ public function getNiceCreatedAt() {
return date('M j, Y g:ia');
}
+ protected function beforeSave() {
+ if(parent::beforeSave()) {
+ $now = date('Y-m-d H:i:s');
+ if($this->isNewRecord) {
+ $this->created_at = $now;
+ $this->last_seen_at = $now;
+ $this->last_login_at = $now;
+ }
+ $this->updated_at = $now;
+ return true;
+ }
+ return false;
+ }
+
/*public function attributeLabels()
{
return array(
Please sign in to comment.
Something went wrong with that request. Please try again.