/** * @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; }