Пример #1
0
 /**
  * @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();
 }
Пример #2
0
 /**
  * Сохранение в БД
  */
 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;
 }