_dbInstance = Database::getInstance(); $this->_dbHandle = $this->_dbInstance->getDbConnection(); } public function fetchAll(): array { $sqlQuery = 'SELECT * FROM ecoFacilities;'; $statement = $this->_dbHandle->prepare($sqlQuery); // prepare a PDO statement $statement->execute(); // execute the PDO statemen $dataSet = []; // loop through and read the results of the query and cast // them into a matching object while ($row = $statement->fetch()) { $dataSet[] = new FacilityData($row); } return $dataSet; } }