Update Post and Topic models
This commit is contained in:
parent
d407c9310d
commit
84fc2cf463
2 changed files with 14 additions and 2 deletions
|
@ -22,7 +22,13 @@ class Model extends DataModel
|
|||
throw new RuntimeException('Parent is not defined');
|
||||
}
|
||||
|
||||
return $this->c->topics->load($this->topic_id);
|
||||
$topic = $this->c->topics->load($this->topic_id);
|
||||
|
||||
if (! $topic instanceof Topic || $topic->moved_to || ! $topic->parent) {
|
||||
throw new RuntimeException("Parent({$this->topic_id}) is broken for post number {$this->id}");
|
||||
}
|
||||
|
||||
return $topic;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,13 @@ class Model extends DataModel
|
|||
throw new RuntimeException('Parent is not defined');
|
||||
}
|
||||
|
||||
return $this->c->forums->get($this->forum_id);
|
||||
$forum = $this->c->forums->get($this->forum_id);
|
||||
|
||||
if (! $forum instanceof Forum || $forum->redirect_url) {
|
||||
throw new RuntimeException("Parent({$this->forum_id}) is broken for topic number {$this->id}");
|
||||
}
|
||||
|
||||
return $forum;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue