Doc updates to remove PK::Auto::<db> references and miscellaneous trinkets.
Simon Elliott [Tue, 21 Mar 2006 18:52:32 +0000 (18:52 +0000)]
lib/DBIx/Class/Core.pm
lib/DBIx/Class/Manual/Intro.pod
lib/DBIx/Class/Manual/SchemaIntro.pod
lib/DBIx/Class/PK/Auto.pm
lib/DBIx/Class/ResultSource.pm
lib/DBIx/Class/Schema.pm
lib/DBIx/Class/Storage/DBI/SQLite.pm
lib/DBIx/Class/Test/SQLite.pm

index 455e741..0a319dc 100644 (file)
@@ -49,10 +49,6 @@ The core modules currently are:
 
 =back
 
-If you are also using a L<DBIx::Class::PK::Auto> component, please
-make sure you load it correctly. Refer to
-L<DBIx::Class::PK::Auto/DESCRIPTION> for more information.
-
 =head1 AUTHORS
 
 Matt S. Trout <mst@shadowcatsystems.co.uk>
index f288db6..53f20ef 100644 (file)
@@ -32,10 +32,8 @@ connections.
   __PACKAGE__->load_components(qw/Core DB/);
 
 If you want serial/auto-incrementing primary keys, you should use the
-L<DBIx::Class::PK::Auto> component for your database.  For example, if
-you're using SQLite add C<PK::Auto::SQLite> to the list:
-
-  __PACKAGE__->load_components(qw/PK::Auto::SQLite Core DB/);
+L<DBIx::Class::PK::Auto> component. 
+  __PACKAGE__->load_components(qw/PK::Auto Core DB/);
 
 C<PK::Auto> classes exist for many databases; see
 L<DBIx::Class::PK::Auto> for more information.
index 1e6707e..b1275eb 100644 (file)
@@ -44,9 +44,9 @@ Next, create each of the classes you want to load as specified above:
 
 Load any components required by each class with the load_components() method.
 This should consist of "Core" plus any additional components you want to use.
-For example, if you use SQLite and want serial/auto-incrementing primary keys:
+For example, if you want serial/auto-incrementing primary keys:
 
-  __PACKAGE__->load_components(qw/ PK::Auto::SQLite Core /);
+  __PACKAGE__->load_components(qw/ PK::Auto Core /);
 
 C<PK::Auto> classes exist for many databases; see
 L<DBIx::Class::PK::Auto> for more information.
index 64c8c83..24f8810 100644 (file)
@@ -11,29 +11,17 @@ DBIx::Class::PK::Auto - Automatic primary key class
 
 =head1 SYNOPSIS
 
-  # In your table classes (replace PK::Auto::SQLite with your database)
-  __PACKAGE__->load_components(qw/PK::Auto::SQLite Core/);
-  __PACKAGE__->set_primary_key('id');
+__PACKAGE__->load_components(qw/PK::Auto Core/);
+__PACKAGE__->set_primary_key('id');
 
 =head1 DESCRIPTION
 
 This class overrides the insert method to get automatically incremented primary
 keys.
 
-You don't want to be using this directly - instead load the appropriate one for
-your database, e.g. C<PK::Auto::SQLite>, in your table classes:
+  __PACKAGE__->load_components(qw/PK::Auto Core/);
 
-  __PACKAGE__->load_components(qw/PK::Auto::SQLite Core/);
-
-Note that C<PK::Auto::SQLite> is specified as the leftmost argument.
-
-Alternatively, you can load the components separately:
-
-  __PACKAGE__->load_components(qw/Core/);
-  __PACKAGE__->load_components(qw/PK::Auto::SQLite/);
-
-This can be used, for example, if you have different databases and need to
-determine the appropriate C<PK::Auto> class at runtime.
+Note that C<PK::Auto> is specified as the leftmost argument.
 
 =head1 LOGIC
 
index e4ba46f..250cc5d 100644 (file)
@@ -618,6 +618,22 @@ sub related_source {
   return $self->schema->source($self->relationship_info($rel)->{source});
 }
 
+=head2 related_class
+
+=head3 Arguments: ($relname)
+
+Returns the class object for the given relationship
+
+=cut
+
+sub related_class {
+  my ($self, $rel) = @_;
+  if( !$self->has_relationship( $rel ) ) {
+    $self->throw_exception("No such relationship '$rel'");
+  }
+  return $self->schema->class($self->relationship_info($rel)->{source});
+}
+
 =head2 resultset
 
 Returns a resultset for the given source, by calling:
index 19b49c3..efabcf4 100644 (file)
@@ -26,7 +26,7 @@ DBIx::Class::Schema - composable schemas
 
   package Library::Schema::CD;
   use base qw/DBIx::Class/;
-  __PACKAGE__->load_components(qw/PK::Auto::Pg Core/); # for example
+  __PACKAGE__->load_components(qw/PK::Auto Core/); # for example
   __PACKAGE__->table('cd');
 
   # Elsewhere in your code:
@@ -225,10 +225,9 @@ sub load_classes {
 
 =head3 Arguments: <target> <@db_info>
 
-This is the most important method in this class. it takes a target namespace,
-as well as dbh connection info, and creates a L<DBIx::Class::DB> class as
-well as subclasses for each of your database classes in this namespace, using
-this connection.
+This method takes a target namespace, as well as dbh connection info, 
+and creates a L<DBIx::Class::DB> class as well as subclasses for each of
+your database classes in this namespace, using this connection.
 
 It will also setup a ->class method on the target class, which lets you
 resolve database classes based on the schema component name, for example
@@ -285,6 +284,14 @@ sub compose_connection {
   return $schema;
 }
 
+=head2 compose_namespace
+
+=head3 Arguments: <target> <base>
+
+Translates <base> namespace into the specified <target> namespace. 
+
+=cut
+
 sub compose_namespace {
   my ($self, $target, $base) = @_;
   my %reg = %{ $self->source_registrations };
index e6175b5..6893398 100644 (file)
@@ -18,7 +18,7 @@ DBIx::Class::PK::Auto::SQLite - Automatic primary key class for SQLite
 =head1 SYNOPSIS
 
   # In your table classes
-  __PACKAGE__->load_components(qw/PK::Auto::SQLite Core/);
+  __PACKAGE__->load_components(qw/PK::Auto Core/);
   __PACKAGE__->set_primary_key('id');
 
 =head1 DESCRIPTION
index 5023e8c..97642ce 100644 (file)
@@ -34,7 +34,7 @@ use strict;
 
 use base qw/DBIx::Class/;
 
-__PACKAGE__->load_components(qw/PK::Auto::SQLite CDBICompat Core DB/);
+__PACKAGE__->load_components(qw/PK::Auto CDBICompat Core DB/);
 
 use File::Temp qw/tempfile/;
 my (undef, $DB) = tempfile();