/** * @ParamConverter("branch", options={"mapping": {"meta": "meta", "branch": "branchId"}, "repository_method" = "findOneWithParent"}) */ public function privRepoAction(Branch $branch, $key) { if ($branch->isPublic() || $branch->getPrivateKey() != $key) { throw new NotFoundHttpException('Branch not found!'); } $response = new Response($branch->getGeneratedJson()); $response->headers->set('Content-Type', 'application/json'); return $response; }