/** * Add Active Table */ public function addActiveTableAction() { // get Current user $user = $this->container->get('security.context')->getToken()->getUser(); // Check if user auth in app if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException("Access denied"); } // collect data $tableNumber = $this->getRequest()->request->get('tableNumber'); $tableTop = $this->getRequest()->request->get('tableTop'); $tableLeft = $this->getRequest()->request->get('tableLeft'); $mapId = $this->getRequest()->request->get('mapId'); $tableTypeId = $this->getRequest()->request->get('tableType'); // create new Active Table $tableMap = $this->getTableMapManager()->findOneById($mapId); $tableType = $this->getTableTypeManager()->findOneById($tableTypeId); $activeTable = new ActiveTable(); $activeTable->setLeftPosition($tableLeft); $activeTable->setTableMap($tableMap); $activeTable->setTableNumber($tableNumber); $activeTable->setTableType($tableType); $activeTable->setTopPosition($tableTop); $em = $this->getDoctrine()->getManager(); $em->persist($activeTable); $em->flush(); return $this->redirect($this->generateUrl("table_viewCreateMap", array("restaurantId" => $tableMap->getRestaurant()->getId())) . "?mapId={$mapId}"); }