findMap

Execute the query returning a map of the objects.

We use setMapKey() to specify the property to be used as keys on the map. If one is not specified then the id property is used. The name of the properties is the name they have on the Model, not the name of the database column.

Map<String, Product> map = database.find(Product.class)
    .setMapKey("sku")
    .findMap();