コード例 #1
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function beforeInsert()
 {
     parent::beforeInsert();
 }
コード例 #2
0
ファイル: Entity.php プロジェクト: floxim/floxim
 protected function beforeInsert()
 {
     if (!$this['component_id']) {
         return;
     }
     if ($this->getPayload('skip_sql')) {
         return;
     }
     $type = $this->getSqlType();
     if (!$type) {
         return;
     }
     try {
         fx::db()->query("ALTER TABLE `{{" . $this->getTable() . "}}`\n                ADD COLUMN `" . $this['keyword'] . "` " . $type);
         parent::beforeInsert();
         $this->column_created = true;
     } catch (\Exception $e) {
         $this->invalid('Can not create column ' . $this['keyword'] . ": " . $e->getMessage());
     }
 }