/**
  * @Security("has_role('ROLE_USER')")
  * @ParamConverter("colonie", options={"mapping": {"colonie_id" : "id"}})  
  */
 public function viewAllAction(Colonie $colonie)
 {
     if (!$this->getUser()->canDisplayExploitation($colonie->getRuche()->getRucher()->getExploitation())) {
         throw new NotFoundHttpException('Page inexistante.');
     }
     return $this->render('KGBeekeepingManagementBundle:Recolte:viewAll.html.twig', array('colonie' => $colonie));
 }
 /**
  * @Security("has_role('ROLE_USER')")
  * @ParamConverter("colonie", options={"mapping": {"colonie_id" : "id"}})  
  */
 public function addAction(Colonie $colonie, Request $request)
 {
     if (!$this->getUser()->canDisplayExploitation($colonie->getRuche()->getRucher()->getExploitation()) || !$colonie->canHaveNewTranshumance()) {
         throw new NotFoundHttpException('Page inexistante.');
     }
     $transhumance = new Transhumance($colonie);
     $form = $this->createForm(new TranshumanceType(), $transhumance);
     if ($form->handleRequest($request)->isValid()) {
         $transhumance->getColonie()->getRuche()->setEmplacement($transhumance->getEmplacementto());
         $em = $this->getDoctrine()->getManager();
         $em->persist($transhumance);
         $em->flush();
         $flash = $this->get('braincrafted_bootstrap.flash');
         $flash->success('Transhumance créée avec succès');
         return $this->redirect($this->generateUrl('kg_beekeeping_management_view_ruche', array('ruche_id' => $transhumance->getColonie()->getRuche()->getId())));
     }
     return $this->render('KGBeekeepingManagementBundle:Transhumance:add.html.twig', array('form' => $form->createView(), 'colonie' => $colonie));
 }
Beispiel #3
0
 /**
  * Set colonie
  *
  * @param \KG\BeekeepingManagementBundle\Entity\Colonie $colonie
  * @return Visite
  */
 public function setColonie(\KG\BeekeepingManagementBundle\Entity\Colonie $colonie)
 {
     $this->colonie = $colonie;
     $colonie->addVisite($this);
     return $this;
 }
Beispiel #4
0
 /**
  * Constructor
  */
 public function __construct(Colonie $colonie)
 {
     $this->colonie = $colonie;
     $this->setNbcouvain($colonie->getRuche()->getCorps()->getNbcouvain());
     $this->setNbnourriture($colonie->getRuche()->getCorps()->getNbnourriture());
     if (!$colonie->getVisites()->isEmpty()) {
         $lastVisite = $colonie->getVisites()->last();
         $this->setActivite($lastVisite->getActivite());
         $this->setEtat($lastVisite->getEtat());
         $this->setAgressivite($lastVisite->getAgressivite());
         $this->setPoids($lastVisite->getPoids());
     }
     $this->setDate(new \DateTime());
     $this->hausses = new \Doctrine\Common\Collections\ArrayCollection();
     $this->taches = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($colonie->getRuche()->getHausses() as $hausse) {
         $this->addHauss(new HausseVisite($this, $hausse->getNbplein(), $hausse->getNbcadres()));
     }
 }
Beispiel #5
0
 /**
  * diviser
  *
  * @param var $origine
  * @return Colonie
  */
 public function diviser($origine)
 {
     $reineMere = $this->remerages->last()->getReine();
     $colonie = new Colonie();
     $colonie->setOrigineColonie($origine);
     $colonie->remerages->last()->getReine()->setRace($reineMere->getRace());
     $colonie->remerages->last()->getReine()->setReineMere($reineMere);
     return $colonie;
 }
 /**
  * Constructor
  */
 public function __construct(Colonie $colonie)
 {
     $this->colonie = $colonie;
     $this->emplacementfrom = $colonie->getRuche()->getEmplacement();
     $this->rucherfrom = $colonie->getRuche()->getRucher();
 }
 /**
  * @Security("has_role('ROLE_USER')")
  * @ParamConverter("colonie", options={"mapping": {"colonie_id" : "id"}})  
  */
 public function tuerAction(Colonie $colonie, Request $request)
 {
     if (!$this->getUser()->canDisplayExploitation($colonie->getRuche()->getRucher()->getExploitation()) || !$colonie->canBeTuee()) {
         throw new NotFoundHttpException('Page inexistante.');
     }
     $form = $this->createForm(new CauseType(), $colonie);
     if ($form->handleRequest($request)->isValid()) {
         $colonie->setMorte(true);
         $colonie->getRuche()->getEmplacement()->setRuche();
         $colonie->getRuche()->setEmplacement();
         $em = $this->getDoctrine()->getManager();
         $em->persist($colonie);
         $em->flush();
         $flash = $this->get('braincrafted_bootstrap.flash');
         $flash->success('La mort de la colonie a bien été enregistrée');
         return $this->redirect($this->generateUrl('kg_beekeeping_management_view_ruche', array('ruche_id' => $colonie->getRuche()->getId())));
     }
     return $this->render('KGBeekeepingManagementBundle:Colonie:tuer.html.twig', array('form' => $form->createView(), 'colonie' => $colonie));
 }