diff --git a/application/controllers/CommentController.php b/application/controllers/CommentController.php new file mode 100644 index 00000000..4a68ddaf --- /dev/null +++ b/application/controllers/CommentController.php @@ -0,0 +1,61 @@ +setTitle($this->translate('Comment')); + + $name = $this->params->shiftRequired('name'); + + $query = Comment::on($this->getDb()) + ->with('host') + ->with('host.state'); + + $query->getSelectBase() + ->where(['comment.name = ?' => $name]); + + $comment = $query->first(); + if ($comment === null) { + throw new NotFoundError($this->translate('Comment not found')); + } + + $this->comment = $comment; + } + + protected function fetchCommandTargets() + { + return [$this->comment]; + } + + protected function getCommandTargetsUrl() + { + return Links::comment($this->comment); + } + + public function indexAction() + { + $detail = new CommentDetail($this->comment); + + $this->addControl($detail->getControl()); + $this->addContent($detail); + } +}