Version: current

# Class RatePeriod

A single database record & abstract class for the data-access-model.

## Extensions and Decorators

See `Extension` and `DataObjectDecorator`.

## Permission Control

Object-level access control by `Permission`. Permission codes are arbitrary strings which can be selected on a group-by-group basis.

    class Article extends DataObject implements PermissionProvider {
            static $api_access = true;

            public function canView($member = false) {
                    return Permission::check('ARTICLE_VIEW');
            }
            public function canEdit($member = false) {
                    return Permission::check('ARTICLE_EDIT');
            }
            public function canDelete() {
                    return Permission::check('ARTICLE_DELETE');
            }
            public function canCreate() {
                    return Permission::check('ARTICLE_CREATE');
            }
            public function providePermissions() {
                    return array(
                            'ARTICLE_VIEW' => 'Read an article object',
                            'ARTICLE_EDIT' => 'Edit an article object',
                            'ARTICLE_DELETE' => 'Delete an article object',
                            'ARTICLE_CREATE' => 'Create an article object',
                    );
            }
    }

Object-level access control by `Group` membership:

    class Article extends DataObject {
            static $api_access = true;

            public function canView($member = false) {
                    if(!$member) $member = Member::currentUser();
            return $member->inGroup('Subscribers');
            }
            public function canEdit($member = false) {
                    if(!$member) $member = Member::currentUser();
            return $member->inGroup('Editors');
            }

            // ...
    }

If any public method on this class is prefixed with an underscore, the results are cached in memory through `ViewableData::cachedCall()`.

  Object
  ViewableData implements IteratorAggregate
  DataObject implements DataObjectInterface, i18nEntityProvider
  RatePeriod

Package: sapphire\model
Located at booking/code/RatePeriod.php

## Methods summary

`public string` | # `getTitle( )` Standard implementation of a title/label for a specific record. Tries to find properties 'Title' or 'Name', and falls back to the 'ID'. Useful to provide user-friendly identification of a record, e.g. in errormessages or UI-selections. Standard implementation of a title/label for a specific record. Tries to find properties 'Title' or 'Name', and falls back to the 'ID'. Useful to provide user-friendly identification of a record, e.g. in errormessages or UI-selections. Overload this method to have a more specialized implementation, e.g. for an Address record this could be:
    public function getTitle() {
      return "{$this->StreetNumber} {$this->StreetName} {$this->City}";
    }
#### Returns `string` string #### Overrides `DataObject::getTitle`

### Methods inherited from DataObject

`Aggregate()`, `RelationshipAggregate()`, `__construct()`, `baseTable()`, `belongs_to()`, `buildDataObjectSet()`, `buildSQL()`, `can()`, `canCreate()`, `canDelete()`, `canEdit()`, `canView()`, `castedUpdate()`, `composite_fields()`, `context_obj()`, `customDatabaseFields()`, `custom_database_fields()`, `data()`, `databaseFields()`, `databaseIndexes()`, `database_extensions()`, `database_fields()`, `db()`, `dbObject()`, `debug()`, `defaultSearchFilters()`, `defineMethods()`, `delete()`, `delete_by_id()`, `destroy()`, `disableCMSFieldsExtensions()`, `disable_subclass_access()`, `duplicate()`, `enableCMSFieldsExtensions()`, `enable_subclass_access()`, `exists()`, `extendedSQL()`, `fieldLabel()`, `fieldLabels()`, `flushCache()`, `flush_and_destroy_cache()`, `forceChange()`, `get()`, `getAllFields()`, `getCMSActions()`, `getCMSFields()`, `getChangedFields()`, `getClassAncestry()`, `getComponent()`, `getComponents()`, `getComponentsQuery()`, `getDefaultSearchContext()`, `getField()`, `getFrontEndFields()`, `getManyManyComponents()`, `getManyManyComponentsQuery()`, `getManyManyFilter()`, `getManyManyJoin()`, `getRemoteJoinField()`, `getReverseAssociation()`, `get_by_id()`, `get_one()`, `get_validation_enabled()`, `hasDatabaseField()`, `hasField()`, `hasOwnTableDatabaseField()`, `hasValue()`, `has_many()`, `has_one()`, `has_own_table()`, `i18n_plural_name()`, `i18n_singular_name()`, `inheritedDatabaseFields()`, `instance_get()`, `instance_get_one()`, `isChanged()`, `isEmpty()`, `isInDB()`, `is_composite_field()`, `many_many()`, `many_many_extraFields()`, `merge()`, `newClassInstance()`, `onAfterDelete()`, `onAfterWrite()`, `onBeforeDelete()`, `onBeforeWrite()`, `plural_name()`, `populateDefaults()`, `provideI18nEntities()`, `relObject()`, `requireDefaultRecords()`, `requireTable()`, `reset()`, `scaffoldFormFields()`, `scaffoldSearchFields()`, `searchableFields()`, `setCastedField()`, `setClassName()`, `setComponent()`, `setField()`, `set_context_obj()`, `set_validation_enabled()`, `singular_name()`, `summaryFields()`, `toMap()`, `update()`, `validate()`, `write()`, `writeComponents()`, `writeWithoutVersion()`

### 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()`, `escapeTypeForField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`

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

`public static array` | $db | # Database field definitions. This is a map from field names to field type. The field type should be a class that extends . Database field definitions. This is a map from field names to field type. The field type should be a class that extends .
`public static array` | $casting | # Use a casting object for a field. This is a map from field name to class name of the casting object. Use a casting object for a field. This is a map from field name to class name of the casting object.
`public static string` | $default_sort | # The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided. The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided.
`public static array` | $searchable_fields | # Default list of fields that can be scaffolded by the ModelAdmin search interface. Default list of fields that can be scaffolded by the ModelAdmin search interface. Overriding the default filter, with a custom defined filter:
           static $searchable_fields = array(
              "Name" => "PartialMatchFilter"
    );
Overriding the default form fields, with a custom defined field. The 'filter' parameter will be generated from `DBField::$default_search_filter_class`. The 'title' parameter will be generated from DataObject->fieldLabels().
           static $searchable_fields = array(
              "Name" => array(
                           "field" => "TextField"
                   )
    );
Overriding the default form field, filter and title:
           static $searchable_fields = array(
              "Organisation.ZipCode" => array(
                           "field" => "TextField",
                           "filter" => "PartialMatchFilter",
                           "title" => 'Organisation ZIP'
                   )
    );
`public static array` | $summary_fields | # Provides a default list of fields to be used by a 'summary' view of this object. Provides a default list of fields to be used by a 'summary' view of this object.

### Properties inherited from DataObject

`$allowed_actions`, `$ancestry`, `$api_access`, `$belongs_many_many`, `$belongs_to`, `$brokenOnDelete`, `$brokenOnWrite`, `$cache_get_one`, `$cache_has_own_table`, `$cache_has_own_table_field`, `$componentCache`, `$components`, `$create_table_options`, `$default_records`, `$defaults`, `$destroyed`, `$field_labels`, `$has_many`, `$has_one`, `$indexes`, `$many_many`, `$many_many_extraFields`, `$original`, `$plural_name`, `$record`, `$singular_name`

### Properties inherited from ViewableData

`$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. -