예제 #1
0
 public function init()
 {
     parent::init();
     if (empty($this->value)) {
         $this->value = new Expression('NOW()');
     }
 }
예제 #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (empty($this->attributes)) {
         if ($this->createdAtAttribute || $this->updatedAtAttribute) {
             $this->attributes[BaseActiveRecord::EVENT_BEFORE_INSERT] = [];
         }
         if ($this->createdAtAttribute) {
             $this->attributes[BaseActiveRecord::EVENT_BEFORE_INSERT][] = $this->createdAtAttribute;
         }
         if ($this->updatedAtAttribute) {
             $this->attributes[BaseActiveRecord::EVENT_BEFORE_INSERT][] = $this->updatedAtAttribute;
             $this->attributes[BaseActiveRecord::EVENT_BEFORE_UPDATE] = $this->updatedAtAttribute;
         }
     }
 }
예제 #3
0
 /**
  * Инициализация времени
  */
 public function init()
 {
     parent::init();
     $this->value = new Expression('NOW()');
 }