Version: current

# Class ArrayData

Lets you wrap a bunch of array data into a `ViewableData` object.

    new ArrayData(array(
       "ClassName" => "Page",
       "AddAction" => "Add a new Page page",
    ));

  Object
  ViewableData implements IteratorAggregate
  ArrayData

Package: sapphire\view
Located at sapphire/core/ArrayData.php

## Methods summary

`public` | # `__construct( object|array $array )` #### Parameters $array object|array $array Either an object with simple properties or an associative array. Converts object-properties to indices of an associative array. #### Overrides `Object::__construct`
`public mixed` | # `getField( string $f )` Get the value of a field on this object. This should be overloaded in child classes. Get the value of a field on this object. This should be overloaded in child classes. #### Parameters $f string $field #### Returns `mixed` mixed #### Overrides `ViewableData::getField`
`public boolean` | # `hasField( string $f )` Check if a field exists on this object. This should be overloaded in child classes. Check if a field exists on this object. This should be overloaded in child classes. #### Parameters $f string $field #### Returns `boolean` bool #### Overrides `ViewableData::hasField`
`protected static array` | # `object_to_array( `ViewableData::obj()` $obj )` Converts an object with simple properties to an associative array. Converts an object with simple properties to an associative array. #### Parameters $obj obj $obj #### Returns `array` array
`public` | # `forTemplate( )` This is pretty crude, but it helps diagnose error situations This is pretty crude, but it helps diagnose error situations
`public` | # `getAllFields( )`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### 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()`, `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 mixed` | $array | #

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### 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. -