Difference between revisions of "Freeside:1.9:Documentation:Developer/FS/m2m Common"

From Freeside
Jump to: navigation, search
(import from POD)
 
m (Edit via perl MediaWiki framework (1.13))
 
Line 10: Line 10:
 
FS::m2m_Common is intended as a mixin class for classes which have a many-to-many relationship with another table (via a linking table).
 
FS::m2m_Common is intended as a mixin class for classes which have a many-to-many relationship with another table (via a linking table).
  
Note: It is currently assumed that the link table contains two fields named the same as the primary keys of ths base and target tables.
+
It is currently assumed that the link table contains two fields named the same as the primary keys of the base and target tables, but you can ovverride this assumption if your table is different.
  
 
==METHODS==
 
==METHODS==
 
; process_m2m OPTION => VALUE, ...
 
; process_m2m OPTION => VALUE, ...
 
:Available options:
 
:Available options:
 
+
:; link_table (required):; target_table (required):; params (required)
:link_table (required) -
+
::hashref; keys are primary key values in target_table (values are boolean). For convenience, keys may optionally be prefixed with the name of the primary key, as in "agentnum54" instead of "54", or passed as an arrayref of values.
 
+
:; base_field (optional)
:target_table (required) -
+
::base field, defaults to primary key of this base table
 
+
:; target_field (optional)
:params (required) - hashref; keys are primary key values in target_table (values are boolean). For convenience, keys may optionally be prefixed with the name of the primary key, as in agentnum54 instead of 54, or passed as an arrayref of values.
+
::target field, defaults to the primary key of the target table
 +
:; hashref (optional)
 +
::static hashref further qualifying the m2m fields
  
 
==BUGS==
 
==BUGS==
 
==SEE ALSO==
 
==SEE ALSO==
 
[[Freeside:1.9:Documentation:Developer/FS/Record|FS::Record]]
 
[[Freeside:1.9:Documentation:Developer/FS/Record|FS::Record]]
 +
 +
==POD ERRORS==
 +
Hey! '''The above document had some coding errors, which are explained below:'''
 +
 +
; Around line 161:
 +
:You forgot a '=back' before '=head1'

Latest revision as of 17:15, 6 February 2009

NAME

FS::m2m_Common - Mixin class for classes in a many-to-many relationship

SYNOPSIS

use FS::m2m_Common;

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

DESCRIPTION

FS::m2m_Common is intended as a mixin class for classes which have a many-to-many relationship with another table (via a linking table).

It is currently assumed that the link table contains two fields named the same as the primary keys of the base and target tables, but you can ovverride this assumption if your table is different.

METHODS

process_m2m OPTION => VALUE, ...
Available options:
link_table (required)
; target_table (required):; params (required)
hashref; keys are primary key values in target_table (values are boolean). For convenience, keys may optionally be prefixed with the name of the primary key, as in "agentnum54" instead of "54", or passed as an arrayref of values.
base_field (optional)
base field, defaults to primary key of this base table
target_field (optional)
target field, defaults to the primary key of the target table
hashref (optional)
static hashref further qualifying the m2m fields

BUGS

SEE ALSO

FS::Record

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 161:
You forgot a '=back' before '=head1'