コード例 #1
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function beforeDelete()
 {
     parent::beforeDelete();
     $files = $this->getFileParams();
     foreach ($files as $f) {
         fx::files()->rm($f);
     }
 }
コード例 #2
0
ファイル: Entity.php プロジェクト: floxim/floxim
 public function validate()
 {
     $fields = $this->getComponent()->getAllFields();
     foreach ($fields as $f) {
         if ($f['is_required'] && !$this[$f['keyword']]) {
             $this->invalid($f['name'] . ': ' . fx::lang('This field is required'), $f['keyword']);
         }
     }
     return parent::validate();
 }
コード例 #3
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function afterDelete()
 {
     parent::afterDelete();
     fx::alang()->dropDictFiles($this['dict']);
 }
コード例 #4
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function afterDelete()
 {
     parent::afterDelete();
     $path = fx::path()->abs($this->getPath());
     fx::files()->rm($path);
 }
コード例 #5
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function afterInsert()
 {
     parent::afterInsert();
     $this->scaffold();
 }
コード例 #6
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function afterDelete()
 {
     if ($this['component_id']) {
         if (self::getSqlTypeByType($this->data['type'])) {
             try {
                 fx::db()->query("ALTER TABLE `{{" . $this->getTable() . "}}` DROP COLUMN `" . $this['keyword'] . "`");
             } catch (\Exception $e) {
                 fx::log('Drop field exception', $e->getMessage());
             }
         }
     }
     parent::afterDelete();
 }