public static function getStudentDetails($student_id)
 {
     try {
         $conn = connection::getConnectionObject();
         $con = $conn->getConnection();
         $stm = $con->stmt_init();
         $stm->prepare("SELECT name,batch,faculty FROM Student where student_id=?");
         $stm->bind_param("s", $student_id);
         //           // $result = mysqli_query($con,$sql);
         //
         //
         $stm->execute();
         $result = $stm->get_result();
         //
         $student = new Student();
         //
         while ($row = $result->fetch_assoc()) {
             $student->setName($row["name"]);
             $student->setFaculty($row["faculty"]);
             $student->setBatch($row["batch"]);
         }
         return $student;
     } catch (Exception $e) {
         return "error";
     } finally {
         //$conn->close();
         $stm->close();
     }
 }
 public function addStudentAction()
 {
     $student = new Entity\Student();
     $student->setStudentId($_POST["student_id"]);
     $student->setName($_POST["name"]);
     $student->setFaculty($_POST["faculty"]);
     $student->setBatch($_POST["batch"]);
     $student->setAddress($_POST["address"]);
     $student->setNic($_POST["nic"]);
     $telArray = array();
     $contact = new Entity\StudentContact();
     $contact->setStudentId($_POST["student_id"]);
     $telNo1 = $_POST["telNo1"];
     $telNo2 = $_POST["telNo2"];
     //$telArray[]=$contact;
     if ($telNo1 != "") {
         $contact = new Entity\StudentContact();
         $contact->setStudentId($_POST["student_id"]);
         $contact->setContactNo($telNo1);
         $telArray[] = $contact;
     }
     if ($telNo2 != "") {
         $contact2 = new Entity\StudentContact();
         $contact2->setStudentId($_POST["student_id"]);
         $contact2->setContactNo($telNo2);
         $telArray[] = $contact2;
     }
     //$v=$telArray[1];
     //echo $telArray.length;
     cont\StudentDBaccess::addStudent($student, $telArray);
     return $this->render('applicationMainBundle:Default:index.html.twig');
 }