public static function getAllSports()
 {
     try {
         $conn = connection::getConnectionObject();
         $con = $conn->getConnection();
         $stm = $con->stmt_init();
         $stm->prepare("SELECT sport_id,name FROM Sport");
         //           // $result = mysqli_query($con,$sql);
         //
         //
         $stm->execute();
         $result = $stm->get_result();
         //
         $equipmentArray = array();
         while ($row = $result->fetch_assoc()) {
             $eqOb = new Sport();
             $eqOb->setName($row["name"]);
             $eqOb->setSportId($row["sport_id"]);
             $equipmentArray[] = $eqOb;
         }
         return $equipmentArray;
     } catch (Exception $e) {
         return "error";
     } finally {
         //$conn->close();
         // $stm->close();
     }
 }
 public static function getAllSports()
 {
     try {
         $conn = connection::getConnectionObject();
         $con = $conn->getConnection();
         $stm = $con->stmt_init();
         $stm->prepare("SELECT name,sport_id FROM Sport");
         $stm->execute();
         $result = $stm->get_result();
         $sportArray = array();
         $count = 0;
         while ($row = $result->fetch_assoc()) {
             $sport = new Sport();
             $sport->setName($row["name"]);
             $sport->setSportId($row["sport_id"]);
             $sportArray[] = $sport;
         }
         return $sportArray;
     } catch (Exception $e) {
         return "error";
     } finally {
         //$conn->close();
         $stm->close();
     }
 }
 public function saveSportAction()
 {
     $spr = new en\Sport();
     $sportName = $_POST["sportname"];
     $sportId = $_POST["sportid"];
     if ($sportName == NULL) {
         echo "Please enter valid a Sport Name";
         return $this->render('SportBundle:AddSport:addSport.html.twig');
     } else {
         $spr->setName($sportName);
         $spr->setSportId($sportId);
         cont\SportDBaccess::saveSport($spr);
         return $this->render('SportBundle:Message:dbsave.html.twig');
     }
 }