privilegeService = $privilegeService; $this->postService = $postService; $this->postViewProxy = $postViewProxy; } public function getMethods() { return ['GET']; } public function getUrl() { return '/api/posts/:postNameOrId'; } public function work() { $this->privilegeService->assertPrivilege(Privilege::VIEW_POSTS); $post = $this->postService->getByNameOrId($this->getArgument(postNameOrId)); return $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig()); } }