CommentController: Already fetch required relations with the first query

This commit is contained in:
Johannes Meyer 2020-01-15 15:08:11 +01:00
parent 61b50abd2b
commit 382f2ef198

View file

@ -27,7 +27,14 @@ class CommentController extends Controller
$name = $this->params->shiftRequired('name');
$query = Comment::on($this->getDb())->with(['host', 'host.state']);
$query = Comment::on($this->getDb())->with([
'host',
'host.state',
'service',
'service.state',
'service.host',
'service.host.state'
]);
$query->getSelectBase()
->where(['comment.name = ?' => $name]);