public static function getAll($fields = null)
    {
        $table = self::getTableNameFromClass();

        if ($fields != null && is_array($fields)) {
            $query =  "SELECT ". implode(', ', $fields) ." FROM $table";
        } else {
            $query = "SELECT * FROM $table";
        }

        $res = [];

        $results = Connection::db()->query($query);
        $results->setFetchMode(PDO::FETCH_ASSOC);

        while ($row = $results->fetch()) {
            array_push($res, $row);
        }

        return $res;
    }
public static function getAll($fields = null)
    {
        $table = self::getTableNameFromClass();

        if ($fields != null && is_array($fields)) {
            $query =  "SELECT ". implode(', ', $fields) ." FROM $table";
        } else {
            $query = "SELECT * FROM $table";
        }

        $res = [];

        $results = Connection::db()->query($query);
        $results->setFetchMode(PDO::FETCH_ASSOC);

        while ($row = $results->fetch()) {
            array_push($res, $row);
        }

        return $res;
    }
public static function getAll ( $ fields = null ) { $ table = self :: getTableNameFromClass ( ) ; if ( $ fields != null && is_array ( $ fields ) ) { $ query = "SELECT " . implode ( ', ' , $ fields ) . " FROM $table" ; } else { $ query = "SELECT * FROM $table" ; } $ res = [ ] ; $ results = Connection :: db ( ) -> query ( $ query ) ; $ results -> setFetchMode ( PDO :: FETCH_ASSOC ) ; while ( $ row = $ results -> fetch ( ) ) { array_push ( $ res , $ row ) ; } return $ res ; }
Get all records from the record table
@param array $fields array of fields to be retrieved
@return array associative array of the records received from the database
Get all records from the record table