예제 #1
0
 /**
  * @ParamConverter("meta", options={"mapping": {"meta": "metaId"}})
  */
 public function showOverviewAction(Request $request, Meta $meta)
 {
     $builds = $meta->getDefaultBranch()->getBuilds();
     $data = array();
     foreach ($builds as $build) {
         if ($build->getState() == Build::DONE) {
             $b = json_decode($build->getGeneratedJSON())->mods[0];
             $b->build = $build;
             $data[] = $b;
         }
     }
     return $this->render('HLPNebulaBundle:Meta:overview.html.twig', ['meta' => $meta, 'builds' => $builds, 'meta_data' => $data]);
 }
예제 #2
0
 /**
  * @ParamConverter("meta", options={"mapping": {"meta": "metaId"}})
  * @Security("is_granted('EDIT', meta)")
  */
 public function createAction(Request $request, Meta $meta)
 {
     $branch = new Branch();
     $form = $this->createForm(new BranchType(), $branch);
     if ($form->handleRequest($request)->isValid()) {
         if ($meta->getNbBranches() == 0) {
             $branch->setIsDefault(true);
         }
         if (!$branch->isPublic()) {
             $branch->setPrivateKey();
         }
         $meta->addBranch($branch);
         $em = $this->getDoctrine()->getManager();
         $em->persist($branch);
         $em->flush();
         $request->getSession()->getFlashBag()->add('success', 'New branch <strong>"' . $branch->getName() . '" (id: ' . $branch->getBranchId() . ')</strong> successfully created.');
         return $this->redirect($this->generateUrl('hlp_nebula_repository_branch', array('meta' => $meta, 'branch' => $branch)));
     }
     return $this->render('HLPNebulaBundle:Branch:create.html.twig', array('meta' => $meta, 'form' => $form->createView()));
 }