GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Tangram::Type::Set::FromMany(3) User Contributed Perl Documentation Tangram::Type::Set::FromMany(3)

Tangram::Type::Set::FromMany - maps Set::Object using a link table

   use Tangram;

   # or
   use Tangram::Core;
   use Tangram::Type::Set::FromMany;

   $schema = Tangram::Schema->new(

      classes => { Company => { fields => {

      set =>
      {
         # long form
         employee =>
         {
            class => 'Person',
            table => 'Company_employees',
            coll => 'company',
            item => 'employee',
         },

         # short form
         assets => 'Asset',
      }

Maps a reference to a Set::Object. The persistent fields are grouped in a hash under the "set" 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 link table to save the state of the collection. The table has two columns: one contains the id of the container objects; the other contains the ids of the elements.

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:

  • class
  • aggreg
  • table
  • coll
  • item
  • deep_update

Mandatory field "class" specifies the class of the elements.

Optional field "aggreg" specifies that the elements of the collection must be removed (erased) from persistent storage along with the containing object. The default is not to aggregate.

Optional field "table" sets the name of the link table. This defaults to 'C_F', where C is the class of the containing object and F is the field name.

Optional field "coll" sets the name the column containing the ids of the containing objects. This defaults to 'coll'.

Optional field "item" sets the name the column containing the ids of the elements. This defaults to 'item'.

Optional field "deep_update" specificies that all elements have to be updated automatically when "update" is called on the collection object. Automatic update ensures consisitency between the Perl representation and the DBMS state, but degrades update performance so use it with caution. The default is not to do automatic updates.

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.

2015-10-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.