From: David Kamholz Date: Sun, 20 Nov 2005 22:00:25 +0000 (+0000) Subject: small cleanup to last patch X-Git-Tag: v0.05005~169 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ab99068d2201468f1fe8ed065ba9c0328e1b30c;p=dbsrgits%2FDBIx-Class.git small cleanup to last patch --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 8bacb76..1d2b4c6 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -15,7 +15,6 @@ illustrate: # Set up inherited connection information package MyApp::DBIC; - use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto::SQLite Core DB/); @@ -36,16 +35,16 @@ illustrate: sub books { my ($self) = @_; return MyApp::DBIC::Book->search( - { 'b2a.authID' => $self->authID }, { join => 'b2a' } - ); + { 'b2a.authID' => $self->authID }, # WHERE clause + { join => 'b2a' } # join condition (part of search attrs) # 'b2a' refers to the relationship named earlier in the Author class. # 'b2a.authID' refers to the authID column of the b2a relationship, # which becomes accessible in the search by being joined. + ); } # define the link table class package MyApp::DBIC::Book2Author; - use base qw/MyApp::DBIC/; __PACKAGE__->table('book2author'); @@ -56,7 +55,6 @@ illustrate: __PACKAGE__->belongs_to('bookID' => 'MyApp::DBIC::Book'); package MyApp::DBIC::Book; - use base qw/MyApp::DBIC/; __PACKAGE__->table('books'); @@ -69,7 +67,7 @@ illustrate: my ($self) = @_; return MyApp::DBIC::Author->search( { 'b2a.bookID' => $self->bookID }, # WHERE clause - { join => 'b2a' }); # Join condition + { join => 'b2a' }); # join condition (part of search attrs) } # So the above search returns an author record where the bookID field of the