[Dbix-class] Cookbook bug
Lanny Ripple
lanny at cisco.com
Mon Sep 22 19:20:04 BST 2008
I've come across a bug in the cookbook code for 'Arbitrary SQL
through a custom ResultSource'. If you name resultsets by full
class name and have defined a complex query using the suggested code
you will find the class_mapping is poisoned and your normal
resultsource maps to the complex resultsource when using the full
class name.
This is fixed by the attached diff.
Enjoy,
-ljr
-------------- next part --------------
Index: Cookbook.pod
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Cookbook.pod (revision 4845)
+++ Cookbook.pod (working copy)
@@ -90,7 +90,9 @@
# Make a new ResultSource based on the User class
my $source =3D __PACKAGE__->result_source_instance();
my $new_source =3D $source->new( $source );
+
$new_source->source_name( 'UserFriendsComplex' );
+ $new_source->result_class( 'My::Schema::UserFriendsComplex' );
=
# Hand in your query as a scalar reference
# It will be added as a sub-select after FROM,
More information about the DBIx-Class
mailing list