/** * @return nc_routing_route * @throws nc_routing_pattern_parser_exception */ public function save() { // Для новых записей установить наивысший (1) приоритет if (!$this->get_id()) { $this->set('priority', 1); $site_id = (int) $this->get('site_id'); nc_db()->query("UPDATE `{$this->table_name}`\n SET `Priority` = `Priority` + 1\n WHERE `Site_ID` = {$site_id}"); } $this->set('compiled_pattern', new nc_routing_pattern($this->get('pattern'))); return parent::save(); }
/** * Сохранение в БД */ public function save() { $this->set_mysql_encoding(); try { parent::save(); } catch (Exception $e) { $this->restore_mysql_encoding(); throw $e; } $this->restore_mysql_encoding(); return $this; }