public function show($id) { $entity = $this->modifyShowQuery($this->model->newQuery())->with($this->ctx->with())->find($id); if (!$entity) { return $this->response->build(['error' => 'not_found'], SymfonyResponse::HTTP_NOT_FOUND); } // hook: afterShow() if ($hookResult = $this->afterShow($entity)) { return $hookResult; } return $this->response->build($entity); }