owner))->extInstance($this->class)) return; $fields = $this->extraDBFields(); $className = $this->owner->class; if($fields) { foreach($fields as $relationType => $fields) { if(in_array($relationType, self::$decoratable_statics)) { eval("$className::\$$relationType = array_merge((array){$className}::\$$relationType, (array)\$fields);"); $this->owner->set_stat($relationType, eval("return $className::\$$relationType;")); } $this->owner->set_uninherited('fieldExists', null); } } } /** * Edit the given query object to support queries for this extension * * @param SQLQuery $query Query to augment. */ function augmentSQL(SQLQuery &$query) { } /** * Update the database schema as required by this extension. */ function augmentDatabase() { } /** * Augment a write-record request. * * @param SQLQuery $manipulation Query to augment. */ function augmentWrite(&$manipulation) { } /** * 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 array Returns a map where the keys are db, has_one, etc, and * the values are additional fields/relations to be defined. */ function extraDBFields() { return array(); } /** * This function is used to provide modifications to the form in the CMS * by the decorator. * By default, no changes are made - if you want you can overload this * function. * * @param FieldSet $fields The FieldSet to modify. */ function updateCMSFields(FieldSet &$fields) { } } ?>