about this statement: $new_source->name( \<<SQL );
why I can't find out the method name "name" in class ResultSource? thanks Mike.G 2008/11/9 Mike. G <[EMAIL PROTECTED]> > Hi, everyone, I think I had asked this problem, but I forgot this. > please remind me. thanks > > in cookbook, we have example like this: > > package My::Schema::User; > > use base qw/DBIx::Class/; > > > # ->load_components, ->table, ->add_columns, etc. > > # Make a new ResultSource based on the User class > my $source = __PACKAGE__->result_source_instance(); > my $new_source = $source->new( $source ); > > $new_source->source_name( 'UserFriendsComplex' ); > > # 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! > > $new_source->name( \<<SQL ); > ( SELECT u.* FROM user u > INNER JOIN user_friends f ON u.id = f.user_id > WHERE f.friend_user_id = ? > UNION > SELECT u.* FROM user u > > INNER JOIN user_friends f ON u.id = f.friend_user_id > WHERE f.user_id = ? ) > SQL > > # Finally, register your new ResultSource with your Schema > > > > I think this is register myself ResultSource, > > but I have those question: > 1. > my $source = __PACKAGE__->result_source_instance(); > the method result_source_instance is which class's method? > > 2. I had take a look the ResultSource method: > I found there are no any method like : > > my $new_source = $source->new( $source ); > so, that document's issue? > > > thanks > > Mike.G > > > My::Schema->register_source( 'UserFriendsComplex' => $new_source ); > > >
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
