예제 #1
0
파일: Entity.php 프로젝트: floxim/floxim
 protected function afterUpdate()
 {
     parent::afterUpdate();
     // modified image fields
     $image_fields = $this->getFields()->find('keyword', $this->modified)->find('type', array(Field\Entity::FIELD_IMAGE, Field\Entity::FIELD_FILE));
     foreach ($image_fields as $img_field) {
         $old_value = $this->modified_data[$img_field['keyword']];
         if (fx::path()->isFile($old_value)) {
             fx::files()->rm($old_value);
         }
     }
 }
예제 #2
0
파일: Entity.php 프로젝트: floxim/floxim
 protected function afterUpdate()
 {
     if ($this['component_id']) {
         $type = self::getSqlTypeByType($this->data['type']);
         if ($type) {
             if ($this->modified_data['keyword'] && $this->modified_data['keyword'] != $this->data['keyword']) {
                 fx::db()->query("ALTER TABLE `{{" . $this->getTable() . "}}`\n                    CHANGE `" . $this->modified_data['keyword'] . "` `" . $this->data['keyword'] . "` " . $type);
             } else {
                 if ($this->modified_data['type'] && $this->modified_data['type'] != $this->data['type']) {
                     fx::db()->query("ALTER TABLE `{{" . $this->getTable() . "}}`\n                    MODIFY `" . $this->data['keyword'] . "` " . $type);
                 }
             }
         }
     }
     parent::afterUpdate();
 }