Version: current

# Class SQLMap

This is a class used to represent key->value pairs generated from database queries. The query isn't actually executed until you need it.

  Object
  SQLMap implements IteratorAggregate

Package: sapphire\model
Located at sapphire/core/model/SQLMap.php

## Methods summary

`public` | # `__construct( `SQLQuery` $query, mixed $keyField = "ID", mixed $titleField = "Title" )` Construct a SQLMap. Construct a SQLMap. #### Parameters $query SQLQuery $query The query to generate this map. THis isn't executed until it's needed. $keyField $titleField #### Overrides `Object::__construct`
`public string` | # `getItem( string|integer $id )` Get the name of an item. Get the name of an item. #### Parameters $id string|int $id The id of the item. #### Returns `string` string
`public` | # `getIterator( )` #### Implementation of `IteratorAggregate::getIterator()`
`public `DataObjectSet`` | # `getItems( )` Get the items in this class. Get the items in this class. #### Returns ``DataObjectSet`` DataObjectSet
`protected` | # `genItems( )` Generate the items in this map. This is used by getItems() if the items have not been generated already. Generate the items in this map. This is used by getItems() if the items have not been generated already.

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `defineMethods()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`protected `SQLQuery`` | $query | # The query used to generate the map. The query used to generate the map.
`protected mixed` | $keyField | #
`protected mixed` | $titleField | #

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -