/** * @Route("/course/{id}/{weeks}", name="course_by_id", options={"expose"=true}) * @ParamConverter("id", class="\TS\CYABundle\Entity\Course") * @Method("GET") * * @param Course $course * @param $weeks * @return JsonResponse */ public function courseByIdAction(Course $course, $weeks) { foreach ($course->getCourseRangeWeeks() as $courseRangeWeek) { $price = $courseRangeWeek->isThisRange($weeks); if ($price) { return new JsonResponse(number_format($price * $weeks, 2, '.', ',')); } } return new JsonResponse(0); }
/** * Creates a form to delete a Course entity. * * @param Course $course The Course entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Course $course) { return $this->createFormBuilder()->setAction($this->generateUrl('admin_course_delete', array('id' => $course->getId())))->setMethod('DELETE')->getForm(); }