|
NAMETangram::Type::Set::FromOne - map Set::Object using a foreign key SYNOPSIS use Tangram;
# or
use Tangram::Core;
use Tangram::Type::Set::FromOne;
$schema = Tangram::Schema->new(
classes => { Basket => { fields => {
iset =>
{
# long form
fruits =>
{
class => 'Fruit',
coll => 'basket',
},
# or (short form)
fruits => 'Fruit',
}
DESCRIPTIONThis class maps references to Set::Object collections in an intrusive fashion. The persistent fields are grouped in a hash under the "iset" key in the field hash. The set may contain only objects of persistent classes. These classes must have a common persistent base class. Tangram uses a column on the element's table to store the id of the object containing the collection. CAUTION: the same object may not be an element of the same collection, in two different objects. This mapping may be used only for one-to-many relationships. The field names are passed in a hash that associates a field name with a field descriptor. The field descriptor may be either a hash or a string. The hash uses the following fields:
If the descriptor is a string, it is interpreted as the name of the element's class. This is equivalent to specifying only the "class" field in the hash variant.
|