$this->id = $this->trimmed('id');
- $this->question = QnA_Question::staticGet('id', $this->id);
+ $this->question = QnA_Question::getKV('id', $this->id);
if (empty($this->question)) {
// TRANS: Client exception thrown trying to view a non-existing question.
throw new ClientException(_m('No such question notice.'), 404);
}
- $this->user = User::staticGet('id', $this->question->profile_id);
+ $this->user = User::getKV('id', $this->question->profile_id);
if (empty($this->user)) {
// TRANS: Client exception thrown trying to view a question of a non-existing user.
throw new ServerException(_m('User without a profile.'));
}
- $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
+ try {
+ $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
+ } catch (Exception $e) {
+ $this->avatar = null;
+ }
return true;
}
}
if (count($answerIds) > 0) {
- $notice = new Notice();
- $notice->query(
- sprintf(
- 'SELECT notice.* FROM notice WHERE notice.id IN (%s)',
- implode(',', $answerIds)
- )
- );
+ $notice = Notice::multiGet('id', $answerIds);
$nli = new NoticeList($notice, $this);
$nli->show();