public static function getAllLocations()
 {
     try {
         $conn = connection::getConnectionObject();
         $con = $conn->getConnection();
         $stm = $con->stmt_init();
         $stm->prepare("SELECT resource_id ,locationName FROM location");
         //
         //
         $stm->execute();
         $result = $stm->get_result();
         //
         $locationarray = array();
         $count = 0;
         while ($row = $result->fetch_assoc()) {
             $location = new Location();
             $location->setName($row["locationName"]);
             $location->setResourceid($row["resource_id"]);
             $locationarray[] = $location;
         }
         return $locationarray;
     } catch (Exception $e) {
         return "error";
     } finally {
         //$conn->close();
         $stm->close();
     }
 }
 public function saveLocationAction()
 {
     $eqpm = new en\Location();
     $rs = new en\resource();
     $eqpm->setResourceId($_POST["resource_id"]);
     $eqpm->setType($_POST["locationtype"]);
     $eqpm->setSession($_POST["sessionlimit"]);
     $eqpm->setName($_POST["locationName"]);
     $rs->setResourceId($_POST["resource_id"]);
     $rs->setSupplierId($_POST["supplier_id"]);
     cont\ResourceDBaccess::addResource($rs);
     cont\LocationDBaccess::addLocation($eqpm);
     return $this->render('applicationLocationsBundle:Default:index.html.twig');
 }