X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource%2FView.pm;h=161a94e32b0ca8a4bcbbf2fb46d9c22197d71657;hb=534521dac62f6ab58e83a42d4e8e3cb586db464b;hp=f9acd69c689bacf7514df64ce0a13c6dfd50984a;hpb=c584b60bb5dd58ca2f9a0b7d018cc40356ec2f52;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSource/View.pm b/lib/DBIx/Class/ResultSource/View.pm index f9acd69..161a94e 100644 --- a/lib/DBIx/Class/ResultSource/View.pm +++ b/lib/DBIx/Class/ResultSource/View.pm @@ -8,8 +8,7 @@ use DBIx::Class::ResultSet; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/ResultSource/); __PACKAGE__->mk_group_accessors( - 'simple' => qw(is_virtual view_definition) -); + 'simple' => qw(is_virtual view_definition deploy_depends_on) ); =head1 NAME @@ -17,7 +16,7 @@ DBIx::Class::ResultSource::View - ResultSource object representing a view =head1 SYNOPSIS - package MyDB::Schema::Result::Year2000CDs; + package MyApp::Schema::Result::Year2000CDs; use base qw/DBIx::Class::Core/; @@ -64,7 +63,7 @@ case replaces the view name in a FROM clause in a subselect. =head1 EXAMPLES -Having created the MyDB::Schema::Year2000CDs schema as shown in the SYNOPSIS +Having created the MyApp::Schema::Year2000CDs schema as shown in the SYNOPSIS above, you can then: $2000_cds = $schema->resultset('Year2000CDs') @@ -107,7 +106,7 @@ You could now say: $schema->resultset('Year2000CDs')->all(); - SELECT cdid, artist, title FROM + SELECT cdid, artist, title FROM (SELECT cdid, artist, title FROM cd WHERE year ='2000') me =back @@ -130,6 +129,14 @@ database-based view. An SQL query for your view. Will not be translated across database syntaxes. +=head2 deploy_depends_on + + __PACKAGE__->result_source_instance->deploy_depends_on( + ["MyApp::Schema::Result::Year","MyApp::Schema::Result::CD"] + ); + +Specify the views (and only the views) that this view depends on. +Pass this an array reference of fully qualified result classes. =head1 OVERRIDDEN METHODS @@ -141,28 +148,40 @@ or the SQL as a subselect if this is a virtual view. =cut sub from { - my $self = shift; - return \"(${\$self->view_definition})" if $self->is_virtual; - return $self->name; + my $self = shift; + return \"(${\$self->view_definition})" if $self->is_virtual; + return $self->name; } -1; +=head1 OTHER METHODS -=head1 AUTHORS +=head2 new -Matt S. Trout +The constructor. -With Contributions from: +=cut -Guillermo Roditi Egroditi@cpan.orgE +sub new { + my ( $self, @args ) = @_; + my $new = $self->next::method(@args); + $new->{deploy_depends_on} = + { map { $_ => 1 } + @{ $new->{deploy_depends_on} || [] } } + unless ref $new->{deploy_depends_on} eq 'HASH'; + return $new; +} -Jess Robinson +=head1 FURTHER QUESTIONS? -Wallace Reis +Check the list of L. -=head1 LICENSE +=head1 COPYRIGHT AND LICENSE -You may distribute this code under the same terms as Perl itself. +This module is free software L +by the L. You can +redistribute it and/or modify it under the same terms as the +L. =cut +1;