Skip to content
Snippets Groups Projects
Commit eb4bda84 authored by JediKev's avatar JediKev
Browse files

orm: Refetch Failure

This addresses an ORM failure where upon refetching an object from the
database that no longer exists the system crashes hard. We use the `one()`
method which expects one result, if there is no result it throws a
`DoesNotExist` exception. We are not catching the exception properly which
crashes osTicket and forces you to clear the session via browser or
database.
parent bbd0c255
No related branches found
No related tags found
No related merge requests found
......@@ -717,9 +717,11 @@ class VerySimpleModel {
}
private function refetch() {
$this->ht =
static::objects()->filter($this->getPk())->values()->one()
+ $this->ht;
try {
$this->ht =
static::objects()->filter($this->getPk())->values()->one()
+ $this->ht;
} catch (DoesNotExist $ex) {}
}
private function getPk() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment