Difference between revisions of "Freeside:3:Documentation:Developer/FS/option Common"
From Freeside
m (Edit via perl MediaWiki framework (1.13)) |
(No difference)
|
Latest revision as of 20:05, 27 June 2012
Contents
NAME
FS::option_Common - Base class for option sub-classes
SYNOPSIS
use FS::option_Common;
@ISA = qw( FS::option_Common );
- optional for non-standard names sub _option_table { 'table_name'; } #defaults to ${table}_option sub _option_namecol { 'column_name'; } #defaults to optionname sub _option_valuecol { 'column_name'; } #defaults to optionvalue
DESCRIPTION
FS::option_Common is intended as a base class for classes which have a simple one-to-many class associated with them, used to store a hash-like data structure of keys and values.
METHODS
- insert [ HASHREF | OPTION => VALUE ... ]
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- If a list or hash reference of options is supplied, option records are also created.
- delete
- Delete this record from the database. Any associated option records are also deleted.
- replace [ OLD_RECORD ] [ HASHREF | OPTION => VALUE ... ]
- Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
- If a list or hash reference of options is supplied, option records are created or modified.
- check_options HASHREF
- This method is called by 'insert' and 'replace' to check the options that were supplied.
- Return error-message, or false.
- (In this class, this is a do-nothing routine that always returns false. Override as necessary. No need to call superclass.)
- option_objects
- Returns all options as FS::tablename_option objects.
- options
- Returns a list of option names and values suitable for assigning to a hash.
- option OPTIONNAME
- Returns the option value for the given name, or the empty string.
- option_cacheable OPTIONNAME
- Same as the option method, but may cache and return a cached value. Good for use within loops; otherwise, probably avoid.