Freeside:4:Documentation:Developer/FS/o2m Common

From Freeside
< Freeside:4:Documentation:Developer‎ | FS
Revision as of 07:25, 18 November 2015 by Jeremyd (talk | contribs) (Edit via perl MediaWiki framework (1.13))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NAME

FS::o2m_Common - Mixin class for tables with a related table

SYNOPSIS

use FS::o2m_Common;

@ISA = qw( FS::o2m_Common FS::Record );

DESCRIPTION

FS::o2m_Common is intended as a mixin class for classes which have a related table.

METHODS

process_o2m OPTION => VALUE, ...
Available options:
table (required) - Table into which the records are inserted.
fields (required) - Arrayref of the field names in the "many" table.
params (required) - Hashref of keys and values, often passed as scalar($cgi-Vars)> from a form. This will be scanned for keys of the form "pkeyNN" (where pkey is the primary key column name, and NN is an integer). Each of these designates one record in the "many" table. The contents of that record will be taken from other parameters with the names "pkeyNN_myfield" (where myfield is one of the fields in the 'fields' array).
num_col (optional) - Name of the foreign key column in the "many" table, which links to the primary key of the base table. If not specified, it is assumed this has the same name as in the base table.

BUGS

SEE ALSO

FS::Record