public function getFacilityById($registryId)
 {
     try {
         $selectStmt = new SelectStmt();
         $selectStmt->setTableName(self::TABLE_NAME);
         $whereClauses = array();
         $wc = new WhereClause();
         $wc->setColumn("registry_id");
         $wc->setOperator($wc::OP_EQUAL);
         $wc->setValue($registryId);
         array_push($whereClauses, $wc);
         $selectStmt->setWhereClauses($whereClauses);
         $result = $this->dbService->executeQuery($selectStmt);
         $this->setResponse($result->code, $result->msg, $result->pages, $result->rowCount, $result->data);
     } catch (Exception $e) {
         $this->setResponse(static::SYSTEM_FAILURE_CODE, "System error occurred, unable retrieve facility with ID: " . $registryId, $result->pages, $result->rowCount, array());
     } finally {
         $this->outputResponse();
     }
 }
Exemple #2
0
 function setParams($params)
 {
     foreach ($params as $key => $value) {
         if ($key == "pageSize") {
             $this->pageSize = $value;
         } elseif ($key == "page") {
             $this->page = $value;
         } elseif ($key == "q") {
             //$val = str_replace("|","','",$value);
             $val = "'" . strtoupper($value) . "'";
             $this->where = " WHERE UPPER(registry_id)  REGEXP {$val}\n                        or UPPER(primary_name)  REGEXP  {$val} \n                        or UPPER(city_name)  REGEXP  {$val} \n                        or UPPER(county_name)  REGEXP  {$val} \n                        or UPPER(state_code)  REGEXP  {$val} \n                        or UPPER(state_name)  REGEXP  {$val} \n                        or UPPER(country_name)  REGEXP  {$val} \n                        or UPPER(postal_code)  REGEXP  {$val} \n                        or UPPER(site_type_name)  REGEXP  {$val} ";
         } else {
             $wc = new WhereClause();
             $wc->setColumn($this->camelCaseToUnderScore($key));
             $wc->setValue("%{$value}%");
             array_push($this->whereClauses, $wc);
         }
     }
     if (sizeof($this->whereClauses) > 0) {
         $this->where = $this->createWhere();
     }
 }