Exemplo n.º 1
0
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             $this->url = $this->translit($this->title);
         }
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * Set up URL attribute
  */
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         $this->url = $this->translit($this->title);
         if ($this->isNewRecord) {
             $this->createTime = time();
         } else {
             $this->updateTime = time();
         }
         return true;
     } else {
         return false;
     }
 }