Ejemplo n.º 1
0
 /**
  * @Route("/examn/{id}/{weeks}", name="exam_by_id", options={"expose"=true})
  * @ParamConverter("id", class="\TS\CYABundle\Entity\Exam")
  * @Method("GET")
  *
  * @param Exam $exam
  * @param $weeks
  * @return JsonResponse
  */
 public function examByIdAction(Exam $exam, $weeks)
 {
     foreach ($exam->getExamRangeWeeks() as $examRangeWeek) {
         $price = $examRangeWeek->isThisRange($weeks);
         if ($price) {
             return new JsonResponse(number_format($price * $weeks, 2, '.', ','));
         }
     }
     return new JsonResponse(0);
 }
Ejemplo n.º 2
0
 /**
  * Creates a form to delete a Exam entity.
  *
  * @param Exam $exam The Exam entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Exam $exam)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('admin_exam_delete', array('id' => $exam->getId())))->setMethod('DELETE')->getForm();
 }