Bric::Biz::ElementType::Subelement - Maps a subelement ElementType to its parent's Element Types with occurrence relations and place.
use Bric::Biz::ElementType::Subelement;
# Constructors.
my $subelem = Bric::Biz::ElementType::Subelement->new($init);
my $subelems_href = Bric::Biz::ElementType::Subelement->href($params);
# Instance methods.
my $element_type_id = $subelem->get_parent_element_type_id;
$subelem->set_parent_element_type_id($element_type_id);
my $min = $subelem->get_min_occurrence;
$subelem->set_min_occurrence($min);
my $max = $subelem->get_max_occurrence;
$subelem->set_max_occurrence($max);
my $place = $subelem->get_place;
$subelem->set_place($place);
$subelem->save;
This subclass of Bric::Biz::ElementType manages the relationship between parent ElementTypes and subelement ElementTypes. It contains information on the minimum and maximum occurrence that can be used, and also the place it should appear in when displaying. This class provides accessors to the relevant properties, as well as an href() method to help along the use of a Bric::Util::Coll object.
This class inherits the majority of its interface from Bric::Biz::ElementType. Only additional methods are documented here.
Constructs a new Bric::Biz::ElementType::Subelement object intialized with the values in the $init hash reference and returns it. The suported values for the $init hash reference are the same as those supported by Bric::Biz::ElementType::Subelement->new, with the addition of the following:
child_idThe ID of the element type object on which the new Bric::Biz::ElementType::Subelement will be based. The relevant Bric::Biz::ElementType object will be looked up from the database. Note that all of the $init parameters documented in Bric::Biz::ElementType will be ignored if this parameter is passed.
childThe element type object on which the new Bric::Biz::ElementType::Subelement will be based. Note that all of the $init parameters documented in Bric::Biz::ElementType will be ignored if this parameter is passed.
parent_idThe ID of the Bric::Biz::ElementType object to which this subelement is mapped.
min_occurrenceThe minimum occurrence that the child ElementType must exist within any element with the parent ElementType
max_occurrenceThe maximum occurrence that the child ElementType may exist within any element with the parent ElementType. A max of 0 means that there is no maximum.
placeThe place that the child exists in relation to the other children within the parent element type.
Throws:
Unable to connect to database.
Unable to prepare SQL statement.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: If you pass in an element type object via the child parameter, that element type will be converted into a Bric::Biz::ElementType::Subelement object.
Notes: NONE.
Returns a hash reference of Bric::Biz::ElementType::Subelement objects. Each hash key is a Bric::Biz::ElementType::Subelement ID, and the values are the corresponding Bric::Biz::ElementType::Subelement objects. Only a single parameter argument is allowed, parent_id, though ANY may be used to specify a list of element type IDs. All of the child element types associated with that parent element type ID will be returned.
Throws:
Unable to connect to database.
Unable to prepare SQL statement.
Unable to select column into arrayref.
Unable to execute SQL statement.
Unable to bind to columns to statement handle.
Unable to fetch row from statement handle.
Side Effects: NONE.
Notes: NONE.
##############################################################################
Returns the ID of the Element Type definition of the parent with which this sub element is associated.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Sets the ID of the parent element type definition with which this sub element is associated.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Set the minimum occurrence for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Get the minimum occurrence for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Set the maximum occurrence for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Get the maximum occurrence for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Set the place for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Get the place for this subelement
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Marks this parent/child element type association to be removed. Call the save() method to remove the mapping from the database.
Throws: NONE.
Side Effects: NONE.
Notes: NONE.
Saves the subelement.
Throws:
Bric::_get() - Problems retrieving fields.
Unable to connect to database.
Unable to prepare SQL statement.
Unable to execute SQL statement.
Unable to select row.
Incorrect number of args to _set.
Bric::_set() - Problems setting fields.
Side Effects: NONE.
Notes: NONE.
NONE.
David Wheeler <christian.muise@gmail.com>