.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Rose::DB::Object::Metadata::Relationship::OneToMany 3pm" .TH Rose::DB::Object::Metadata::Relationship::OneToMany 3pm "2022-10-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Rose::DB::Object::Metadata::Relationship::OneToMany \- One to many table relationship metadata object. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Rose::DB::Object::Metadata::Relationship::OneToMany; \& \& $rel = Rose::DB::Object::Metadata::Relationship::OneToMany\->new(...); \& $rel\->make_methods(...); \& ... .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Objects of this class store and manipulate metadata for relationships in which a single row from one table refers to multiple rows in another table. .PP This class inherits from Rose::DB::Object::Metadata::Relationship. Inherited methods that are not overridden will not be documented a second time here. See the Rose::DB::Object::Metadata::Relationship documentation for more information. .SH "METHOD MAP" .IX Header "METHOD MAP" .ie n .IP """count""" 4 .el .IP "\f(CWcount\fR" 4 .IX Item "count" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqcount\*(Aq\*(C'\fR ... .ie n .IP """find""" 4 .el .IP "\f(CWfind\fR" 4 .IX Item "find" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqfind\*(Aq\*(C'\fR ... .ie n .IP """iterator""" 4 .el .IP "\f(CWiterator\fR" 4 .IX Item "iterator" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqiterator\*(Aq\*(C'\fR ... .ie n .IP """get_set""" 4 .el .IP "\f(CWget_set\fR" 4 .IX Item "get_set" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \&\f(CW\*(C`interface => \*(Aqget_set\*(Aq\*(C'\fR ... .ie n .IP """get_set_now""" 4 .el .IP "\f(CWget_set_now\fR" 4 .IX Item "get_set_now" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqget_set_now\*(Aq\*(C'\fR ... .ie n .IP """get_set_on_save""" 4 .el .IP "\f(CWget_set_on_save\fR" 4 .IX Item "get_set_on_save" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqget_set_on_save\*(Aq\*(C'\fR ... .ie n .IP """add_now""" 4 .el .IP "\f(CWadd_now\fR" 4 .IX Item "add_now" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqadd_now\*(Aq\*(C'\fR ... .ie n .IP """add_on_save""" 4 .el .IP "\f(CWadd_on_save\fR" 4 .IX Item "add_on_save" Rose::DB::Object::MakeMethods::Generic, objects_by_key, \f(CW\*(C`interface => \*(Aqadd_on_save\*(Aq\*(C'\fR ... .PP See the Rose::DB::Object::Metadata::Relationship documentation for an explanation of this method map. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "\fBdefault_auto_method_types [\s-1TYPES\s0]\fR" 4 .IX Item "default_auto_method_types [TYPES]" Get or set the default list of auto_method_types. \s-1TYPES\s0 should be a list of relationship method types. Returns the list of default relationship method types (in list context) or a reference to an array of the default relationship method types (in scalar context). The default list contains \*(L"find\*(R", \*(L"get_set_on_save\*(R", and \*(L"add_on_save\*(R". .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .IP "\fBbuild_method_name_for_type \s-1TYPE\s0\fR" 4 .IX Item "build_method_name_for_type TYPE" Return a method name for the relationship method type \s-1TYPE.\s0 .Sp For the method types \*(L"get_set\*(R", \*(L"get_set_now\*(R", and \*(L"get_set_on_save\*(R", the relationship's name is returned. .Sp For the method types \*(L"add_now\*(R" and \*(L"add_on_save\*(R", the relationship's name prefixed with \*(L"add_\*(R" is returned. .Sp For the method type \*(L"find\*(R", the relationship's name prefixed with \*(L"find_\*(R" is returned. .Sp For the method type \*(L"count\*(R", the relationship's name suffixed with \*(L"_count\*(R" is returned. .Sp For the method type \*(L"iterator\*(R", the relationship's name suffixed with \*(L"_iterator\*(R" is returned. .Sp Otherwise, undef is returned. .IP "\fBis_singular\fR" 4 .IX Item "is_singular" Returns false. .IP "\fBmanager_class [\s-1CLASS\s0]\fR" 4 .IX Item "manager_class [CLASS]" Get or set the name of the Rose::DB::Object::Manager\-derived class used to fetch objects. The make_methods method will use Rose::DB::Object::Manager if this value is left undefined. .Sp \&\fBNote:\fR when the name of a relationship that has \f(CW\*(C`manager_args\*(C'\fR is used in a Rose::DB::Object::Manager with_objects or require_objects parameter value, \fIonly\fR the sort_by argument will be copied from \f(CW\*(C`manager_args\*(C'\fR and incorporated into the query. .IP "\fBmanager_method [\s-1METHOD\s0]\fR" 4 .IX Item "manager_method [METHOD]" Get or set the name of the manager_class class method to call when fetching objects. The make_methods method will use get_objects if this value is left undefined. .IP "\fBmanager_count_method [\s-1METHOD\s0]\fR" 4 .IX Item "manager_count_method [METHOD]" Get or set the name of the manager_class class method to call when counting objects. The make_methods method will use get_objects_count if this value is left undefined. .IP "\fBmanager_iterator_method [\s-1METHOD\s0]\fR" 4 .IX Item "manager_iterator_method [METHOD]" Get or set the name of the manager_class class method to call when creating an iterator. The make_methods method will use get_objects_iterator if this value is left undefined. .IP "\fBmanager_args [\s-1HASHREF\s0]\fR" 4 .IX Item "manager_args [HASHREF]" Get or set a reference to a hash of name/value arguments to pass to the manager_method when fetching objects. For example, this can be used to enforce a particular sort order for objects fetched via this relationship. For example: .Sp .Vb 10 \& Product\->meta\->add_relationship \& ( \& code_names => \& { \& type => \*(Aqone to many\*(Aq, \& class => \*(AqCodeName\*(Aq, \& column_map => { id => \*(Aqproduct_id\*(Aq }, \& manager_args => \& { \& sort_by => CodeName\->meta\->table . \*(Aq.name\*(Aq, \& }, \& }, \& ); .Ve .Sp This would ensure that a \f(CW\*(C`Product\*(C'\fR's \f(CW\*(C`code_names()\*(C'\fR are listed in alphabetical order. Note that the \*(L"name\*(R" column is prefixed by the name of the table fronted by the \f(CW\*(C`CodeName\*(C'\fR class. This is important because several tables may have a column named \*(L"name.\*(R" If this relationship is used to form a \s-1JOIN\s0 in a query along with one of those tables, then the \*(L"name\*(R" column will be ambiguous. Adding a table name prefix disambiguates the column name. .Sp Also note that the table name is not hard-coded. Instead, it is fetched from the Rose::DB::Object\-derived class that fronts the table. This is more verbose, but is a much better choice than including the literal table name when it comes to long-term maintenance of the code. .Sp See the documentation for Rose::DB::Object::Manager's get_objects method for a full list of valid arguments for use with the \f(CW\*(C`manager_args\*(C'\fR parameter, but remember that you can define your own custom manager_class and thus can also define what kinds of arguments \f(CW\*(C`manager_args\*(C'\fR will accept. .IP "\fBmap_column \s-1LOCAL\s0 [, \s-1FOREIGN\s0]\fR" 4 .IX Item "map_column LOCAL [, FOREIGN]" If passed a local column name \s-1LOCAL,\s0 return the corresponding column name in the foreign table. If passed both a local column name \s-1LOCAL\s0 and a foreign column name \s-1FOREIGN,\s0 set the local/foreign mapping and return the foreign column name. .IP "\fBcolumn_map [\s-1HASH\s0 | \s-1HASHREF\s0]\fR" 4 .IX Item "column_map [HASH | HASHREF]" Get or set a reference to a hash that maps local column names to foreign column names. .IP "\fBquery_args [\s-1ARRAYREF\s0]\fR" 4 .IX Item "query_args [ARRAYREF]" Get or set a reference to an array of query arguments to add to the query passed to the manager_method when fetching objects. .IP "\fBtype\fR" 4 .IX Item "type" Returns \*(L"one to many\*(R". .SH "AUTHOR" .IX Header "AUTHOR" John C. Siracusa (siracusa@gmail.com) .SH "LICENSE" .IX Header "LICENSE" Copyright (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.