public function init() { parent::init(); if (empty($this->value)) { $this->value = new Expression('NOW()'); } }
/** * @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; } } }
/** * Инициализация времени */ public function init() { parent::init(); $this->value = new Expression('NOW()'); }