JamesMoss\Flywheel\Result::hash PHP Method

hash() public method

Returns an assoiative array (a hash), where for each document the value of one property is the key, and another property is the value.
public hash ( string $keyField, string $valueField ) : array
$keyField string The name of the property to use for the key.
$valueField string Name of the property to use for the value.
return array An associative array.
    public function hash($keyField, $valueField)
    {
        $result = array();
        foreach ($this->documents as $document) {
            $result[$document->{$keyField}] = $document->{$valueField};
        }
        return $result;
    }