Exemplo n.º 1
0
 /**
  * @throws Exception
  * @throws nc_record_exception
  * @return static
  */
 public function delete()
 {
     $site_id = (int) $this->get('site_id');
     $priority = (int) $this->get('priority');
     try {
         parent::delete();
         if ($site_id && $priority) {
             nc_db()->query("UPDATE `{$this->table_name}`\n                        SET `Priority` = `Priority` - 1\n                      WHERE `Site_ID` = {$site_id}\n                        AND `Priority` > {$priority}");
         }
     } catch (nc_record_exception $e) {
         throw $e;
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  *
  */
 protected function select_from_database($query)
 {
     $this->set_mysql_encoding();
     try {
         $result = parent::select_from_database($query);
         $this->restore_mysql_encoding();
         return $result;
     } catch (Exception $e) {
         $this->restore_mysql_encoding();
         throw $e;
     }
 }