public function __construct() { self::$db = MainDB::getInstance(); }
public function executeAttributeQuery($attributes, $colValuePair, $isApplyFilter = false) { foreach ($colValuePair as $key => $value) { if ($value != '') { $query_array[] = $key . ' = ' . "'" . $value . "'"; } } $columns = implode(", ", $attributes); $query = "SELECT " . $columns . " FROM " . $this->tableName . " WHERE " . implode(" AND ", $query_array); if ($isApplyFilter) { $query = FilterUtil::applyFilter($query, false); } $db = MainDB::getInstance(); $conn = $db->getConnection(); $sth = $conn->prepare($query); $sth->execute(); //$this->throwException($sth->errorInfo()); $objList = $sth->fetchAll(); return $objList; }