X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource%2FView.pm;h=c053009a2f31fcf53d43e7ec86af600993e3c999;hb=94244987e66865e4c0c37385248176330ae69029;hp=2229be4e20b23c351f18b61c78d7d6465fafdb88;hpb=e55d9d8946103bc78bb7550fee64aa6f15cc1e56;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSource/View.pm b/lib/DBIx/Class/ResultSource/View.pm index 2229be4..c053009 100644 --- a/lib/DBIx/Class/ResultSource/View.pm +++ b/lib/DBIx/Class/ResultSource/View.pm @@ -4,7 +4,7 @@ use strict; use warnings; use DBIx::Class::ResultSet; -use SQL::Translator::Parser::DBIx::Class; + use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/ResultSource/); __PACKAGE__->mk_group_accessors( @@ -76,7 +76,7 @@ above, you can then: If you modified the schema to include a placeholder __PACKAGE__->result_source_instance->view_definition( - "SELECT cdid, artist, title FROM cd WHERE year ='?'" + "SELECT cdid, artist, title FROM cd WHERE year = ?" ); and ensuring you have is_virtual set to true: @@ -132,31 +132,14 @@ syntaxes. =head2 deploy_depends_on __PACKAGE__->result_source_instance->deploy_depends_on( - "MyDB::Schema::Result::Year","MyDB::Schema::Result::CD" + ["MyDB::Schema::Result::Year","MyDB::Schema::Result::CD"] ); -Specify the result classes that comprise this view. Pass this -method a list. +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 -=head2 new - -The constructor. This is a private method, as only other DBIC modules -should call this. - -=cut - -sub new { - my ( $self, @args ) = @_; - my $new = $self->next::method(@args); - $new->{deploy_depends_on} - = { map { $_ => 1 } @{ ($new->{deploy_depends_on} || []) } }; - use Data::Dumper; - print STDERR Dumper $new; - return $new; -} - =head2 from Returns the FROM entry for the table (i.e. the view name) @@ -170,30 +153,29 @@ sub from { return $self->name; } -=head1 PRIVATE METHODS +=head1 OTHER METHODS -=head2 deploy_depends_on +=head2 new -An internal method for the construction of a hashref of the view's -superclasses, e.g., the sources that comprise it. +The constructor. =cut +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; +} + 1; =head1 AUTHORS -Matt S. Trout - -With Contributions from: - -Guillermo Roditi Egroditi@cpan.orgE - -Jess Robinson - -Wallace Reis - -Amiri Barksdale +See L. =head1 LICENSE