/** * * @param Marche $marche * @return bool */ private function hasAvance(Marche $marche) { return $this->getDoctrine()->getRepository('LaisoArmBundle:Decompte')->findOneBy(array('numero' => 0, 'avenant' => $marche->getAvenants()[0]->getId())) != null; }
/** * @param \Laiso\ArmBundle\Entity\Marche $marche * @param \Laiso\ArmBundle\Entity\Decompte $dp * @return array */ private function getAllAttachement($marche, $dp) { $attachements = array(); /** @var \Laiso\ArmBundle\Entity\Avenant $avenant */ foreach ($marche->getAvenants() as $avenant) { /** @var \Laiso\ArmBundle\Entity\Decompte $decompte */ foreach ($avenant->getDecomptes() as $decompte) { if ($decompte->getNumero() <= $dp->getNumero()) { /** @var \Laiso\ArmBundle\Entity\Attachement $attachement */ foreach ($decompte->getAttachements() as $attachement) { array_push($attachements, $attachement); } } } } return $attachements; }
/** * Edits an existing Marche entity. * */ public function updateAction(Request $request, Marche $marche) { $this->verifyAccess(); $deleteForm = $this->createDeleteForm($marche->getId()); $editForm = $this->createEditForm($marche); $editForm->handleRequest($request); $em = $this->getDoctrine()->getManager(); if ($editForm->isValid()) { $em->flush(); return $this->redirect($this->generateUrl('marche_show', array('id' => $marche->getId()))); } return $this->render('LaisoArmBundle:Marche:edit.html.twig', array('entity' => $marche, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView())); }