|
NAMERose::DB::Object::Metadata::Relationship - Base class for table relationship metadata objects.SYNOPSISpackage MyRelationshipType; use Rose::DB::Object::Metadata::Relationship; our @ISA = qw(Rose::DB::Object::Metadata::Relationship); ... DESCRIPTIONThis is the base class for objects that store and manipulate database table relationship metadata. Relationship metadata objects are responsible for creating object methods that fetch and/or manipulate objects from related tables. See the Rose::DB::Object::Metadata documentation for more information.MAKING METHODSA Rose::DB::Object::Metadata::Relationship-derived object is responsible for creating object methods that manipulate objects in related tables. Each relationship object can make zero or more methods for each available relationship method type. A relationship method type describes the purpose of a method. The default list of relationship method types contains only one type:
Methods are created by calling make_methods. A list of method types can be passed to the call to make_methods. If absent, the list of method types is determined by the auto_method_types method. A list of all possible method types is available through the available_method_types method. These methods make up the "public" interface to relationship method creation. There are, however, several "protected" methods which are used internally to implement the methods described above. (The word "protected" is used here in a vaguely C++ sense, meaning "accessible to subclasses, but not to the public.") Subclasses will probably find it easier to override and/or call these protected methods in order to influence the behavior of the "public" method maker methods. A Rose::DB::Object::Metadata::Relationship object delegates method creation to a Rose::Object::MakeMethods-derived class. Each Rose::Object::MakeMethods-derived class has its own set of method types, each of which takes it own set of arguments. Using this system, four pieces of information are needed to create a method on behalf of a Rose::DB::Object::Metadata::Relationship-derived object:
This information can be organized conceptually into a "method map" that connects a relationship method type to a method maker class and, finally, to one particular method type within that class, and its arguments. There is no default method map for the Rose::DB::Object::Metadata::Relationship base class, but here is the method map from Rose::DB::Object::Metadata::Relationship::OneToOne as an example:
Each item in the map is a relationship method type. For each relationship method type, the method maker class, the method maker method type, and the "interesting" method maker arguments are listed, in that order. The "..." in the method maker arguments is meant to indicate that arguments have been omitted. Arguments that are common to all relationship method types are routinely omitted from the method map for the sake of brevity. If there are no "interesting" method maker arguments, then "..." may appear by itself, as shown above. The purpose of documenting the method map is to answer the question, "What kind of method(s) will be created by this relationship object for a given method type?" Given the method map, it's possible to read the documentation for each method maker class to determine how methods of the specified type behave when passed the listed arguments. To this end, each Rose::DB::Object::Metadata::Relationship-derived class in the Rose::DB::Object module distribution will list its method map in its documentation. This is a concise way to document the behavior that is specific to each relationship class, while omitting the common functionality (which is documented here, in the relationship base class). Remember, the existence and behavior of the method map is really implementation detail. A relationship object is free to implement the public method-making interface however it wants, without regard to any conceptual or actual method map. It must then, of course, document what kinds of methods it makes for each of its method types, but it does not have to use a method map to do so. CLASS METHODS
CONSTRUCTOR
OBJECT METHODS
If any of the methods could not be created for any reason, a fatal error will occur.
PROTECTED APIThese methods are not part of the public interface, but are supported for use by subclasses. Put another way, given an unknown object that "isa" Rose::DB::Object::Metadata::Relationship, there should be no expectation that the following methods exist. But subclasses, which know the exact class from which they inherit, are free to use these methods in order to implement the public API described above.
AUTHORJohn C. Siracusa (siracusa@gmail.com)LICENSECopyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |