Comments: on this page. Click to read or post your own.

Class DataObjectDecorator

Description

Plug-ins for additional functionality in your DataObjects

DataObject decorators add extra functionality to your data objects.

  • abstract:

Located in /sapphire/core/model/DataObjectDecorator.php (line 9)

Object
   |
   --Extension
      |
      --DataObjectDecorator
Direct descendents
Class Description
DataObjectDecoratorTest_ContactRole Plug-ins for additional functionality in your DataObjects
DataObjectTest_Team_Decorator Plug-ins for additional functionality in your DataObjects
FormScaffolderTest_ArticleDecorator Plug-ins for additional functionality in your DataObjects
Hierarchy DataObjects that use the Hierachy decorator can be be organised as a hierachy, with children and parents.
Versioned The Versioned decorator allows your DataObjects to have several versions, allowing you to rollback changes and view history. An example of this is the pages used in the CMS.
Translatable The {Translatable} decorator allows your DataObjects to have versions in different languages, defining which fields are can be translated.
StaticPublisher Plug-ins for additional functionality in your DataObjects
EcommerceRole EcommerceRole is a DataObjectDecorator for the member class to allow additional member fields for the module. It has a base set of contact fields that can be statically called anywhere in the system using singleton('Member')->getEcommerceFields(); The OrderForm and MemberForm class uses this call.
Variable Summary
static array $decoratable_statics
Method Summary
void augmentDatabase ()
void augmentSQL (SQLQuery &$query, SQLQuery $query)
void augmentWrite ( &$manipulation, SQLQuery $manipulation)
array extraDBFields ()
void updateCMSFields ( &$fields, FieldSet $fields)
void updateFormFields ( &$fields, FieldSet $fields)
void updateSummaryFields ( &$fields)
Variables
static array $decoratable_statics = array(
'db',
'has_one',
'indexes',
'defaults',
'has_many',
'many_many',
'belongs_many_many',
'many_many_extraFields',
'searchable_fields',
)
(line 18)

Statics on a DataObject subclass which can be decorated onto. This list is limited for security and performance reasons.

  • access: protected

Inherited Variables

Inherited from Extension

Extension::$allowed_actions
Extension::$owner

Inherited from Object

Object::$builtInMethods
Object::$class
Object::$classConstructed
Object::$extensions
Object::$extension_instances
Object::$extraMethods
Object::$extraStatics
Object::$statics
Object::$static_cached
Methods
augmentDatabase (line 68)

Update the database schema as required by this extension.

void augmentDatabase ()

Redefined in descendants as:
augmentSQL (line 61)

Edit the given query object to support queries for this extension

void augmentSQL (SQLQuery &$query, SQLQuery $query)

Redefined in descendants as:
augmentWrite (line 76)

Augment a write-record request.

void augmentWrite ( &$manipulation, SQLQuery $manipulation)
  • SQLQuery $manipulation: Query to augment.
  • &$manipulation

Redefined in descendants as:
extraDBFields (line 95)

Define extra database fields

Return a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined.

Note: please ensure that the static variable that you are overloading is explicitly defined on the class that you are extending. For example, we have added static $has_one = array() to the Member definition, so that we can add has_one relationships to Member with decorators.

If you forget to do this, db/build won't create the new relation. Don't blame us, blame PHP! ;-)

  • return: Returns a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined.
array extraDBFields ()

Redefined in descendants as:
loadExtraDBFields (line 35)

Load the extra database fields defined in extraDBFields.

  • todo: Rename to "loadExtraStaticFields", as it decorates more than database related fields.
void loadExtraDBFields ()
updateCMSFields (line 112)

This function is used to provide modifications to the form in the CMS by the decorator. By default, no changes are made.

Please consider using updateFormFields() to globally add formfields to the record. The method updateCMSFields() should just be used to add or modify tabs, or fields which are specific to the CMS-context.

Caution: Use FieldSet->addFieldToTab() to add fields.

void updateCMSFields ( &$fields, FieldSet $fields)

Redefined in descendants as:
updateFormFields (line 123)

This function is used to provide modifications to the form in the CMS by the decorator.

Caution: Use FieldSet->push() to add fields.

void updateFormFields ( &$fields, FieldSet $fields)
updateSummaryFields (line 132)

this function is used to provide modifications to the summary fields in CMS

by the decorator By default, the summaryField() of its owner will merge more fields defined in the decorator's $extra_fields['summary_fields']

void updateSummaryFields ( &$fields)
  • &$fields
updateSummaryFieldsExcludeExtra (line 140)
void updateSummaryFieldsExcludeExtra ( &$fields)
  • &$fields

Inherited Methods

Inherited From Extension

Extension::setOwner()

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:39:52 +1300 by phpDocumentor 1.3.2