public function beforeSave($insert) { if ($this->type == self::TYPE_IFRAME || $this->type == self::TYPE_LINK) { $this->content = $this->url; } return parent::beforeSave($insert); }
public function beforeSave($insert) { if ($this->thumbnail_link == "") { $this->thumbnail_link = ""; } return parent::beforeSave($insert); }
public function beforeSave($insert) { if ($this->isNewRecord) { // Updates the updated_at attribute $this->message->save(); } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { if ($this->object_model == "" || $this->object_id == "") { throw new Exception("Could not save content with object_model or object_id!"); } // Set some default values if (!$this->archived) { $this->archived = 0; } if (!$this->visibility) { $this->visibility = self::VISIBILITY_PRIVATE; } if (!$this->sticked) { $this->sticked = 0; } if ($insert) { if ($this->user_id == "") { $this->user_id = Yii::$app->user->id; } } if ($this->user_id == "") { throw new Exception("Could not save content without user_id!"); } return parent::beforeSave($insert); }
public function beforeSave($insert) { $this->sanitizeFilename(); if ($this->title == "") { $this->title = $this->file_name; } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { if (!$this->content->validate()) { throw new Exception("Could not validate associated Content Record! (" . print_r($this->content->getErrors(), 1) . ")"); } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { $this->is_latest = 1; return parent::beforeSave($insert); }