1Rose::DB::Object::LoadeUrs(e3r)Contributed Perl DocumentRaotsieo:n:DB::Object::Loader(3)
2
3
4

NAME

6       Rose::DB::Object::Loader - Automatically create Rose::DB::Object
7       subclasses based on database table definitions.
8

SYNOPSIS

10       Sample database schema:
11
12         CREATE TABLE vendors
13         (
14           id    SERIAL NOT NULL PRIMARY KEY,
15           name  VARCHAR(255) NOT NULL,
16
17           UNIQUE(name)
18         );
19
20         CREATE TABLE products
21         (
22           id      SERIAL NOT NULL PRIMARY KEY,
23           name    VARCHAR(255) NOT NULL,
24           price   DECIMAL(10,2) NOT NULL DEFAULT 0.00,
25
26           vendor_id  INT REFERENCES vendors (id),
27
28           status  VARCHAR(128) NOT NULL DEFAULT 'inactive'
29                     CHECK(status IN ('inactive', 'active', 'defunct')),
30
31           date_created  TIMESTAMP NOT NULL DEFAULT NOW(),
32           release_date  TIMESTAMP,
33
34           UNIQUE(name)
35         );
36
37         CREATE TABLE prices
38         (
39           id          SERIAL NOT NULL PRIMARY KEY,
40           product_id  INT NOT NULL REFERENCES products (id),
41           region      CHAR(2) NOT NULL DEFAULT 'US',
42           price       DECIMAL(10,2) NOT NULL DEFAULT 0.00,
43
44           UNIQUE(product_id, region)
45         );
46
47         CREATE TABLE colors
48         (
49           id    SERIAL NOT NULL PRIMARY KEY,
50           name  VARCHAR(255) NOT NULL,
51
52           UNIQUE(name)
53         );
54
55         CREATE TABLE product_color_map
56         (
57           product_id  INT NOT NULL REFERENCES products (id),
58           color_id    INT NOT NULL REFERENCES colors (id),
59
60           PRIMARY KEY(product_id, color_id)
61         );
62
63       To start, make a Rose::DB::Object::Loader object, specifying the
64       database connection information and an optional class name prefix.
65
66         $loader =
67           Rose::DB::Object::Loader->new(
68             db_dsn       => 'dbi:Pg:dbname=mydb;host=localhost',
69             db_username  => 'someuser',
70             db_password  => 'mysecret',
71             db_options   => { AutoCommit => 1, ChopBlanks => 1 },
72             class_prefix => 'My::Corp');
73
74       It's even easier to specify the database information if you've set up
75       Rose::DB (say, by following the instructions in Rose::DB::Tutorial).
76       Just pass a Rose::DB-derived object pointing to the database you're
77       interested in.
78
79         $loader =
80           Rose::DB::Object::Loader->new(
81             db           => My::Corp::DB->new('main'),
82             class_prefix => 'My::Corp');
83
84       Finally, automatically create Rose::DB::Object subclasses for all the
85       tables in the database.  All it takes is one method call.
86
87         $loader->make_classes;
88
89       Here's what you get for your effort.
90
91         $p = My::Corp::Product->new(name => 'Sled');
92
93         $p->vendor(name => 'Acme');
94
95         $p->prices({ price => 1.23, region => 'US' },
96                    { price => 4.56, region => 'UK' });
97
98         $p->colors({ name => 'red'   },
99                    { name => 'green' });
100
101         $p->save;
102
103         $products =
104           My::Corp::Product::Manager->get_products_iterator(
105             query           => [ name => { like => '%le%' } ],
106             with_objects    => [ 'prices' ],
107             require_objects => [ 'vendor' ],
108             sort_by         => 'vendor.name');
109
110         $p = $products->next;
111
112         print $p->vendor->name; # Acme
113
114         # US: 1.23, UK: 4.56
115         print join(', ', map { $_->region . ': ' . $_->price } $p->prices);
116
117       See the Rose::DB::Object and Rose::DB::Object::Manager documentation
118       for learn more about the features these classes provide.
119
120       The contents of the database now look like this.
121
122         mydb=# select * from products;
123          id |  name  | price | vendor_id |  status  |       date_created
124         ----+--------+-------+-----------+----------+-------------------------
125           1 | Sled 3 |  0.00 |         1 | inactive | 2005-11-19 22:09:20.7988
126
127
128         mydb=# select * from vendors;
129          id |  name
130         ----+--------
131           1 | Acme 3
132
133
134         mydb=# select * from prices;
135          id | product_id | region | price
136         ----+------------+--------+-------
137           1 |          1 | US     |  1.23
138           2 |          1 | UK     |  4.56
139
140
141         mydb=# select * from colors;
142          id | name
143         ----+-------
144           1 | red
145           2 | green
146
147
148         mydb=# select * from product_color_map;
149          product_id | color_id
150         ------------+----------
151                   1 |        1
152                   1 |        2
153

DESCRIPTION

155       Rose::DB::Object::Loader will automatically create Rose::DB::Object
156       subclasses for all the tables in a database.  It will configure column
157       data types, default values, primary keys, unique keys, and foreign
158       keys.  It can also discover and set up inter-table relationships.  It
159       uses Rose::DB::Object's auto-initialization capabilities to do all of
160       this.
161
162       To do its work, the loader needs to know how to connect to the
163       database.  This information can be provided in several ways.  The
164       recommended practice is to set up Rose::DB according to the
165       instructions in the Rose::DB::Tutorial, and then pass a
166       Rose::DB-derived object or class name to the loader.  The loader will
167       also accept traditional DBI-style connection information: DSN,
168       username, password, etc.
169
170       Once the loader object is configured, the make_classes method does all
171       the work.  It takes a few options specifying which tables to make
172       classes for, whether or not to make manager classes for each table, and
173       a few other options.  The convention manager is used to convert table
174       names to class names, generate foreign key and relationship method
175       names, and so on.  The result of this process is a suite of
176       Rose::DB::Object (and Rose::DB::Object::Manager) subclasses ready for
177       use.
178
179       Rose::DB::Object::Loader inherits from, and follows the conventions of,
180       Rose::Object.  See the Rose::Object documentation for more information.
181

GOTCHAS

183       Database schema information is extracted using DBI's schema
184       interrogation methods, which dutifully report exactly how the database
185       describes itself.  In some cases, what the database reports about a
186       particular table may not exactly match what you specified in your table
187       definition.
188
189       The most egregious offender is (surprise!) MySQL, which, to give just
190       one example, tends to offer up empty string default values for non-null
191       character columns.  That is, if you write a table definition like this:
192
193           CREATE TABLE widgets
194           (
195             id   INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
196             name VARCHAR(64) NOT NULL
197           );
198
199       and then interrogate it using DBI, you will find that the "name" column
200       has a default value (as reflected in the "COLUMN_DEF" column returned
201       by DBI's column_info() method) of '' (i.e., an empty string).  In other
202       words, it's as if your table definition was this instead:
203
204           CREATE TABLE widgets
205           (
206             id   INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
207             name VARCHAR(64) NOT NULL DEFAULT ''
208           );
209
210       MySQL is full of such surprises, and it's not the only database to do
211       such things.  Consult the documentation for your database (or do a
212       Google search for "<mydbname> gotchas") for the gory details.
213
214       To work around these kinds of problems, try the pre_init_hook feature.
215       For example, in your  pre_init_hook subroutine you could walk over the
216       list of columns for each class, eliminating all the empty string
217       default values (i.e., changing them to undef instead).
218

CONSTRUCTOR

220       new PARAMS
221           Returns a new Rose::DB::Object::Loader constructed according to
222           PARAMS, where PARAMS are name/value pairs.  Any object method is a
223           valid parameter name.
224

OBJECT METHODS

226       base_class CLASS
227           This is an alias for the base_classes method.
228
229       base_classes [ CLASS | ARRAYREF ]
230           Get or set the list of base classes to use for the Rose::DB::Object
231           subclasses created by the make_classes method.  The argument may be
232           a class name or a reference to an array of class names.  At least
233           one of the classes should inherit from Rose::DB::Object.
234
235           Returns a list (in list context) or reference to an array (in
236           scalar context) of base class names.  Defaults to a dynamically-
237           generated Rose::DB::Object subclass name.
238
239       class_prefix [PREFIX]
240           Get or set the prefix affixed to all class names created by the
241           make_classes method.  If PREFIX doesn't end in "::", it will be
242           added automatically.
243
244       convention_manager [ CLASS | MANAGER ]
245           Get or set the Rose::DB::Object::ConventionManager-derived class
246           name or object to be used during the auto-initialization process
247           for each class created by the make_classes method.  Returns a
248           Rose::DB::Object::ConventionManager-derived object, which defaults
249           to a new Rose::DB::Object::ConventionManager object.
250
251           Unless this attribute is explicitly set or fetched before the call
252           to the make_classes method, the convention manager object used by
253           make_classes will be produced by calling the convention_manager
254           method of the metadata object of the first (left-most) base class.
255
256       db [DB]
257           Get or set the Rose::DB-derived object used to connect to the
258           database.  This object will be used by the make_classes method when
259           extracting information from the database.  It will also be used as
260           the prototype for the db object used by each Rose::DB::Object
261           subclass to connect to the database.
262
263           Setting this attribute also sets the db_class attributes,
264           overwriting any previously existing value, and sets the  db_dsn
265           value to undef.
266
267       db_catalog [CATALOG]
268           Get or set the catalog for the database connection.
269
270       db_class [CLASS]
271           Get or set the name of the Rose::DB-derived class used by the
272           make_classes method to construct a db object if one has not been
273           set via the method of the same name.
274
275           Setting this attribute sets the db attribute to undef unless its
276           class is the same as CLASS.
277
278       db_dsn [DSN]
279           Get or set the DBI-style Data Source Name (DSN) used to connect to
280           the database.  This will be used by the make_classes method when
281           extracting information from the database.  The Rose::DB-derived
282           objects used by each Rose::DB::Object subclass to connect to the
283           database will be initialized with this DSN.
284
285           Setting this attribute immediately sets the dsn of the db
286           attribute, if it is defined.
287
288       db_options [HASHREF]
289           Get or set the options used to connect to the database.
290
291       db_password [PASSWORD]
292           Get or set the password used to connect to the database.
293
294       db_schema [SCHEMA]
295           Get or set the schema for the database connection.
296
297       db_username [USERNAME]
298           Get or set the username used to connect to the database.
299
300       exclude_tables [ REGEX | ARRAYREF ]
301           Get or set a regular expression or reference to an array of table
302           names to exclude.  Table names that match REGEX or are contained in
303           ARRAYREF will be skipped by default during calls to the
304           make_classes method.  Tables without primary keys are automatically
305           (and always) skipped.
306
307           Table names are compared to REGEX and the names in ARRAYREF in a
308           case-insensitive manner.  To override this in the case of the
309           REGEX, add "(?-i)" to the front of the REGEX.  Otherwise, use the
310           filter_tables method instead.
311
312       filter_tables CODEREF
313           Get or set a reference to a subroutine that takes a single table
314           name argument and returns true if the table should be processed by
315           default during calls to the make_classes method, false if the table
316           should be skipped.  The $_ variable will also be set to the table
317           name before the call to CODEREF.
318
319           This attribute should not be combined with the exclude_tables or
320           include_tables attributes.
321
322       force_lowercase [BOOL]
323           Get or set a boolean value that indicates whether or not metadata
324           entity names should be forced to lowercase even when the related
325           entity (e.g., table or column name) is uppercase or mixed case.
326           ("Metadata entities" are thing like columns, relationships, and
327           foreign keys.)  The default value undef.
328
329       generate_manager_class_name CLASS [, CM]
330           Given the name of a Rose::DB::Object-derived class, returns a class
331           name for a Rose::DB::Object::Manager-derived class to manage such
332           objects.  The default implementation calls the
333           auto_manager_class_name method on the convention manager object
334           passed as the optional CM argument, or returned from the
335           convention_manager method if a CM argument is not passed.
336
337       include_tables [ REGEX | ARRAYREF ]
338           Get or set a regular expression or reference to an array of table
339           names to include.  Table names that do not match REGEX or are not
340           contained in ARRAYREF will be skipped by default during calls to
341           the make_classes method.  Tables without primary keys are
342           automatically (and always) skipped.
343
344           Table names are compared to REGEX and the names in ARRAYREF in a
345           case-insensitive manner.  To override this in the case of the
346           REGEX, add "(?-i)" to the front of the REGEX.  Otherwise, use the
347           filter_tables method instead.
348
349       include_predicated_unique_indexes BOOL
350           Get or set a boolean value that will be assigned to the
351           include_predicated_unique_indexes attribute of the
352           Rose::DB::Object::Metadata object for each class created by the
353           make_classes method.  The default value is false.
354
355       include_views BOOL
356           If true, database views will also be processed by default during
357           calls to the make_classes method.  Defaults to false.
358
359       make_classes [PARAMS]
360           Automatically create Rose::DB::Object and (optionally)
361           Rose::DB::Object::Manager subclasses for some or all of the tables
362           in a database.  The class creation process is controlled by the
363           loader object's attributes.  Optional name/value pairs passed to
364           this method may override some of those values.  Valid PARAMS are:
365
366           db [DB]
367               The Rose::DB-derived object used to connect to the database.
368               This object will also be used as the prototype for the db
369               object used by each Rose::DB::Object subclass created by this
370               call to make_classes.  Defaults to the value of the loader
371               object's db attribute.
372
373           db_class [CLASS]
374               The name of the Rose::DB-derived class used to construct a db
375               object if one has not been set via the parameter or object
376               attribute of the same name.  Defaults to the value of the
377               loader object's db_class attribute.
378
379           include_tables [ REGEX | ARRAYREF ]
380               Table names that do not match REGEX or are not contained in
381               ARRAYREF will be skipped.  Defaults to the value of the loader
382               object's include_tables attribute.  Tables without primary keys
383               are automatically (and always) skipped.
384
385               Table names are compared to REGEX and the names in ARRAYREF in
386               a case-insensitive manner.  To override this in the case of the
387               REGEX, add "(?-i)" to the front of the REGEX.  Otherwise, use
388               the "filter_tables" parameter instead.
389
390           exclude_tables [ REGEX | ARRAYREF ]
391               Table names that match REGEX or are contained in ARRAYREF will
392               be skipped.  Defaults to the value of the loader object's
393               exclude_tables attribute.  Tables without primary keys are
394               automatically (and always) skipped.
395
396               Table names are compared to REGEX and the names in ARRAYREF in
397               a case-insensitive manner.  To override this in the case of the
398               REGEX, add "(?-i)" to the front of the REGEX.  Otherwise, use
399               the "filter_tables" parameter instead.
400
401           filter_tables CODEREF
402               A reference to a subroutine that takes a single table name
403               argument and returns true if the table should be processed,
404               false if it should be skipped.  The $_ variable will also be
405               set to the table name before the call.  This parameter cannot
406               be combined with the "exclude_tables" or "include_tables"
407               options.
408
409               Defaults to the value of the loader object's filter_tables
410               attribute, provided that both the "exclude_tables" and
411               "include_tables" values are undefined.  Tables without primary
412               keys are automatically skipped.
413
414           force_lowercase BOOL
415               A boolean value that indicates whether or not metadata entity
416               names should be forced to lowercase even when the related
417               entity is uppercase or mixed case.  ("Metadata entities" are
418               thing like columns, relationships, and foreign keys.)
419
420               If this parameter is omitted and if the loader object's
421               force_lowercase attribute is not defined, then the value is
422               chosen based on the database currently being examined.  If the
423               database is Oracle, then it defaults to true.  Otherwise, it
424               defaults to false.
425
426               The final value is propagated to the convention manager
427               attribute of the same name.
428
429           include_predicated_unique_indexes BOOL
430               This value will be assigned to the
431               include_predicated_unique_indexes attribute of the
432               Rose::DB::Object::Metadata object for each class created by
433               this method.  Defaults to the value of the loader object's
434               include_predicated_unique_indexes attribute.
435
436           include_views BOOL
437               If true, database views will also be processed.  Defaults to
438               the value of the loader object's include_views attribute.
439
440           post_init_hook [ CODEREF | ARRAYREF ]
441               A reference to a subroutine or a reference to an array of code
442               references that will be called just after each
443               Rose::DB::Object-derived class is initialized.  Each referenced
444               subroutine will be passed the class's metadata object plus any
445               arguments to the initialize method.  Defaults to the value of
446               the loader object's post_init_hook attribute.
447
448           pre_init_hook [ CODEREF | ARRAYREF ]
449               A reference to a subroutine or a reference to an array of code
450               references that will be called just before each
451               Rose::DB::Object-derived class is initialized.  Each referenced
452               subroutine will be passed the class's metadata object plus any
453               arguments to the initialize method.  Defaults to the value of
454               the loader object's pre_init_hook attribute.
455
456           require_primary_key BOOL
457               If true, then any table that does not have a primary key will
458               be skipped.  Defaults to the value of the loader object's
459               require_primary_key attribute.  Note that a
460               Rose::DB::Object-derived class based on a table with no primary
461               key will not function correctly in all circumstances.  Use this
462               feature at your own risk.
463
464           warn_on_missing_pk BOOL
465               This is an alias for the "warn_on_missing_primary_key"
466               parameter.
467
468           warn_on_missing_primary_key BOOL
469               If true, then any table that does not have a primary key will
470               trigger a warning.
471
472               If "require_primary_key" is false and the loader object's
473               warn_on_missing_primary_key attribute is undefined, or if the
474               "warn_on_missing_primary_key" parameter is set to an undefined
475               value or is not passed to the make_classes call at all, then
476               "warn_on_missing_primary_key" is set to false.  Otherwise, it
477               defaults to the value of the loader object's
478               warn_on_missing_primary_key attribute.  Note that a
479               Rose::DB::Object-derived class based on a table with no primary
480               key will not function correctly in all circumstances.
481
482               These complicated defaults are intended to honor the intentions
483               of the "require_primary_key" attribute/parameter.  If not
484               requiring primary keys and no explicit decision has been made
485               about whether to warn about missing primary keys, either in the
486               parameters to the  make_classes call or in the loader object
487               itself, then we don't warn about missing primary keys.  The
488               idea is that not requiring primary keys is a strong indication
489               that their absence is not worth a warning.
490
491           with_foreign_keys BOOL
492               If true, set up foreign key metadata for each
493               Rose::DB::Object-derived.  Defaults to the value of the loader
494               object's with_foreign_keys attribute.
495
496           with_managers BOOL
497               If true, create Rose::DB::Object::Manager-derived manager
498               classes for each Rose::DB::Object subclass.  Defaults to the
499               value of the loader object's with_managers attribute.
500
501               The manager class name is determined by passing the
502               Rose::DB::Object-derived class name to the
503               generate_manager_class_name method.
504
505               The Rose::DB::Object subclass's metadata object's
506               make_manager_class method will be used to create the manager
507               class.  It will be passed the return value of the convention
508               manager's auto_manager_base_name method as an argument.
509
510           with_relationships [ BOOL | ARRAYREF ]
511               A boolean value or a reference to an array of relationship type
512               names.  If set to a simple boolean value, then all types of
513               relationships will be considered when making classes.  If set
514               to a list of relationship type names, then only relationships
515               of those types will be considered.  Defaults to the value of
516               the loader object's with_relationships attribute.
517
518           with_unique_keys BOOL
519               If true, set up unique key metadata for each
520               Rose::DB::Object-derived.  Defaults to the value of the loader
521               object's with_unique_keys attribute.
522
523           Any remaining name/value parameters will be passed on to the call
524           to auto_initialize used to set up each class.  For example, to ask
525           the loader not to create any relationships, pass the
526           "with_relationships" parameter with a false value.
527
528               $loader->make_classes(with_relationships => 0);
529
530           This parameter will be passed on to the auto_initialize method,
531           which, in turn, will pass the parameter on to its own call to the
532           auto_init_relationships method.  See the Rose::DB::Object::Metadata
533           documentation for more information on these methods.
534
535           Each Rose::DB::Object subclass will be created according to the
536           "best practices" described in the Rose::DB::Object::Tutorial.  If a
537           base class is not provided, one (with a dynamically generated name)
538           will be created automatically.  The same goes for the db object.
539           If one is not set, then a new (again, dynamically named) subclass
540           of Rose::DB, with its own private data source registry, will be
541           created automatically.
542
543           This method returns a list (in list context) or a reference to an
544           array (in scalar context) of the names of all the classes that were
545           created.  (This list will include manager class names as well, if
546           any were created.)
547
548       make_modules [PARAMS]
549           Automatically create Rose::DB::Object and (optionally)
550           Rose::DB::Object::Manager subclasses for some or all of the tables
551           in a database, then create Perl module (*.pm) files for each class.
552
553           This method calls make_classes to make the actual classes.
554
555           Note: If you are trying to regenerate a set of module files that
556           already exist in the target "module_dir", please make sure that
557           this "module_dir" is not in your @INC path.  (That is, make sure it
558           is not in the set of paths that perl will search when looking for
559           module files in response to a "use" or "require" statement.)  More
560           generally, you must make sure that existing versions of the modules
561           you are attempting to generate are not in your @INC path.
562
563           (If you do not do this, when make_classes makes a class and looks
564           for a related class, it will find and load the previously generated
565           ".pm" file, which will then cause make_classes to skip that class
566           later when it sees that it already exists in memory.  And if
567           make_classes skips it, make_modules will never see it and therefore
568           will never regenerate the ".pm" file.)
569
570           This method takes all of the same parameters as make_classes, with
571           several additions:
572
573           module_dir DIR
574               The path to the directory where the Perl module files will be
575               created.  For example, given a DIR of "/home/john/lib", the
576               Perl module file for the class "My::DB::Object" would be
577               located at "/home/john/lib/My/DB/Object.pm".
578
579               Defaults to the value of the loader object's module_dir
580               attribute.  If the module_dir attribute is also undefined, then
581               the current working directory (as determined by a call to
582               cwd()) is used instead.
583
584           module_preamble [ SCALAR | CODE ]
585               If defined as a scalar, inserts the contents of the variable
586               into the auto-generated file before any of the auto-generated
587               class information.  If provided as a code ref, calls the
588               indicated function, passing the metadata object as a parameter.
589               (The metadata object that belongs to the "object_class" and the
590               Rose::DB::Object::Manager-derived class name are passed if the
591               module is a Rose::DB::Object::Manager-derived class.)  The
592               returned value of the function is inserted as the preamble
593               text.
594
595               Defaults to the value of the loader object's module_preamble
596               attribute.
597
598           module_postamble [ SCALAR | CODE ]
599               If defined as a scalar, inserts the contents of the variable
600               into the auto-generated file after any of the auto-generated
601               class information.  If provided as a code ref, calls the
602               indicated function, passing the metadata object as a parameter.
603               (The metadata object that belongs to the "object_class" and the
604               Rose::DB::Object::Manager-derived class name are passed if the
605               module is a Rose::DB::Object::Manager-derived class.)  The
606               returned value of the function is inserted as the postamble
607               text.
608
609               Defaults to the value of the loader object's module_postamble
610               attribute.
611
612       module_dir [DIR]
613           Get or set the path to the directory where make_modules will create
614           its Perl modules files.  For example, given a DIR of
615           "/home/john/lib", make_modules would create the file
616           "/home/john/lib/My/DB/Object.pm" for the class "My::DB::Object".
617
618       module_preamble [ SCALAR | CODE ]
619           If defined as a scalar, inserts the contents of the variable into
620           the auto-generated file before any of the auto-generated class
621           information.  If provided as a code ref, calls the indicated
622           function, passing the metadata object as a parameter.  (The
623           metadata object that belongs to the "object_class" and the
624           Rose::DB::Object::Manager-derived class name are passed if the
625           module is a Rose::DB::Object::Manager-derived class.)  The returned
626           value of the function is inserted as the preamble text.
627
628       module_postamble [ SCALAR | CODE ]
629           If defined as a scalar, inserts the contents of the variable into
630           the auto-generated file after any of the auto-generated class
631           information.  If provided as a code ref, calls the indicated
632           function, passing the metadata object as a parameter.  (The
633           metadata object that belongs to the "object_class" and the
634           Rose::DB::Object::Manager-derived class name are passed if the
635           module is a Rose::DB::Object::Manager-derived class.)  The returned
636           value of the function is inserted as the postamble text.
637
638       pre_init_hook [CODE]
639           Get or set a reference to a subroutine to be called just before
640           each Rose::DB::Object-derived class is initializeed within the
641           make_classes method.  The subroutine will be passed the class's
642           metdata object as an argument.
643
644       require_primary_key BOOL
645           Get or set a boolean value that determines whether or not the
646           make_classes method will skip any table that does not have a
647           primary key will be skipped.  Defaults to true.
648
649           Note that a Rose::DB::Object-derived class based on a table with no
650           primary key will not function correctly in all circumstances.  Use
651           this feature at your own risk.
652
653       warn_on_missing_pk BOOL
654           This is an alias for the warn_on_missing_primary_key method.
655
656       warn_on_missing_primary_key BOOL
657           Get or set a boolean value that determines whether or not the
658           make_classes method will emit a warning when it encounters a table
659           that does not have a primary key.  Defaults to undefined.
660
661       with_foreign_keys BOOL
662           If true, the make_classes method will set up foreign key metadata
663           for each Rose::DB::Object-derived class it creates.  Defaults to
664           true.
665
666       with_managers [BOOL]
667           If true, the make_classes method will create
668           Rose::DB::Object::Manager-derived manager classes for each
669           Rose::DB::Object subclass by default.  Defaults to true.
670
671           The manager class name is determined by passing the
672           Rose::DB::Object-derived class name to the
673           generate_manager_class_name method.
674
675           The Rose::DB::Object subclass's metadata object's
676           make_manager_class method will be used to create the manager class.
677           It will be passed the return value of the convention manager's
678           auto_manager_base_name method as an argument.
679
680       with_relationships [ BOOL | ARRAYREF ]
681           A boolean value or a reference to an array of relationship type
682           names.  If set to a simple boolean value, then the make_classes
683           method will consider all types of relationships when making
684           classes.  If set to a list of relationship type names, then only
685           relationships of those types will be considered by  make_classes.
686           Defaults to true.
687
688       with_unique_keys BOOL
689           If true, the make_classes method will set up unique key metadata
690           for each Rose::DB::Object-derived class it creates.  Defaults to
691           true.
692
693       manager_base_class CLASS
694           This is an alias for the manager_base_classes method.
695
696       manager_base_classes [ CLASS | ARRAYREF ]
697           Get or set the list of base classes to use for the
698           Rose::DB::Object::Manager subclasses created by the make_classes
699           method.  The argument may be a class name or a reference to an
700           array of class names.  At least one of the classes should inherit
701           from Rose::DB::Object::Manager.
702
703           Returns a list (in list context) or reference to an array (in
704           scalar context) of base class names.  Defaults to
705           Rose::DB::Object::Manager.
706

AUTHOR

708       John C. Siracusa (siracusa@gmail.com)
709

LICENSE

711       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
712       program is free software; you can redistribute it and/or modify it
713       under the same terms as Perl itself.
714
715
716
717perl v5.28.0                      2015-03-18       Rose::DB::Object::Loader(3)
Impressum