X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FCookbook.pod;h=b86ab7a334b4e535379d7cb5743a39f4c5933ec0;hb=d00a5c68a046c661c3fe9991b8b6d4927c306ec6;hp=dbc6a63a24d4f0a95e5a97527ee5cd479fabaeaf;hpb=d23160de49bdf5c8a67eb59dec55c0d1a0a8d019;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index dbc6a63..b86ab7a 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -151,7 +151,36 @@ Next, you can execute your complex query using bind parameters like this: } ) ]; -... and you'll get back a perfect L. +... and you'll get back a perfect L (except, of course, +that you cannot modify the rows it contains, ie. cannot call L, +L, ... on it). + +If you prefer to have the definitions of these custom ResultSources in separate +files (instead of stuffing all of them into the same resultset class), you can +achieve the same with subclassing the resultset class and defining the +ResultSource there: + + package My::Schema::UserFriendsComplex; + + use My::Schema::User; + use base qw/My::Schema::User/; + + __PACKAGE__->table('dummy'); # currently must be called before anything else + + # Hand in your query as a scalar reference + # It will be added as a sub-select after FROM, + # so pay attention to the surrounding brackets! + __PACKAGE__->name( \<