/** * On the page with classes, the user can select a specific class * @Route("/car/{className}", name="viewCar") * @return type */ public function selectCarAction($className, Request $request) { $session = $request->getSession(); $automobileFactory = $this->get('AutoFactory'); $automobileFactory::getInstance(); $car = $session->get("automobileSession"); //Check whether the automobile is already registered in the session if ($car == NULL) { $car = $automobileFactory->createVehicle($className); $christmasDiscount = $this->get('OrdinaryDiscount'); $car->addDiscountOption($christmasDiscount); $session->set("automobileSession", $car); } $specs = $this->getSpecificationsDoctrine(); $availableSpecs = SpecStorage::adjustOptionalSpecifications($car->getDefaultSpecs(), $specs); return $this->render('MercedesVStoreBundle:Default:car.html.twig', array("specifications" => $availableSpecs, "activeMenuItem" => "cars")); }