X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FGeneric.pm;h=95b82d80fc2e1e10c86de985cd2b44c2bc433316;hb=8a6b44efef66c45bdf1336135b0c9c5e5face742;hp=c27538a1778c29af6e7dd6664c9711ec7784bb36;hpb=52bf3f264b3d5e1a0c494e82e13fb377eaa28a6f;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Generic.pm b/lib/DBIx/Class/Schema/Loader/Generic.pm index c27538a..95b82d8 100644 --- a/lib/DBIx/Class/Schema/Loader/Generic.pm +++ b/lib/DBIx/Class/Schema/Loader/Generic.pm @@ -308,9 +308,37 @@ sub _load_classes { =head3 tables -Returns a sorted list of tables. +Returns a sorted list of loaded tables, using the original database table +names. Actually generated from the keys of the C hash below. - my @tables = $loader->tables; + my @tables = $schema->loader->tables; + +=head3 monikers + +Returns a hashref of loaded table-to-moniker mappings for the original +database table names. + + my $monikers = $schema->loader->monikers; + my $foo_tbl_moniker = $monikers->{foo_tbl}; + # -or- + my $foo_tbl_moniker = $schema->loader->monikers->{foo_tbl}; + # $foo_tbl_moniker would look like "FooTbl" + +=head3 classes + +Returns a hashref of table-to-classname mappings for the original database +table names. You probably shouldn't be using this, as operating on the +original class names is usually a bad idea. This hook is here for people +who want to do strange and/or possibly broken things. The usual way to +get at things is C<$schema->resultset('FooTbl')>, where C is a +moniker as returned by C above. + + my $classes = $schema->loader->classes; + my $foo_tbl_class = $classes->{foo_tbl}; + # -or- + my $foo_tbl_class = $schema->loader->classes->{foo_tbl}; + # $foo_tbl_class would look like "My::Schema::FooTbl", + # assuming the schema class is "My::Schema" =cut