Example #1
0
 public function beforeSave()
 {
     if ($this->isNew()) {
         $this->published = date('Y-m-d H:i:s', time());
     }
     return parent::beforeSave();
 }
Example #2
0
 public function beforeDelete()
 {
     foreach ($this->photo as $value) {
         $item = SiteImage::FindByPk($value->Pk);
         $this->deleteImage($item);
         $item->delete();
     }
     return parent::beforeDelete();
 }
Example #3
0
 public function beforeDelete()
 {
     foreach ($this->photo as $value) {
         $item = SiteImage::FindByPk($value->Pk);
         $this->deleteImage($item);
         $item->delete();
     }
     $tmp = new \SplFileInfo(ROOT_PATH_PUBLIC . $item->image);
     rmdir($tmp->getPath());
     return parent::beforeDelete();
 }
Example #4
0
 public function beforeDelete()
 {
     $this->deleteImage();
     return parent::beforeDelete();
 }
Example #5
0
File: Tree.php Project: pr-of-it/t4
 /**
  * Перед удалением модели нужно обновить значения ее служебных полей из БД
  * Иначе удаление поддерева может сработать некорректно
  * @param Model $model
  * @return bool
  */
 public function beforeDelete(Model &$model)
 {
     $model->refreshTreeColumns();
     return true;
 }