Commit | Line | Data |
1d521afd |
1 | package DBIx::Class::ResultSource::View; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use DBIx::Class::ResultSet; |
7 | |
8 | use base qw/DBIx::Class/; |
9 | __PACKAGE__->load_components(qw/ResultSource/); |
030c27ad |
10 | __PACKAGE__->mk_group_accessors( |
11 | 'simple' => qw(is_virtual view_definition) |
12 | ); |
1d521afd |
13 | |
1d521afd |
14 | =head1 NAME |
15 | |
16 | DBIx::Class::ResultSource::Table - Table object |
17 | |
18 | =head1 SYNOPSIS |
19 | |
20 | =head1 DESCRIPTION |
21 | |
22 | Table object that inherits from L<DBIx::Class::ResultSource> |
23 | |
24 | =head1 METHODS |
25 | |
9774f48b |
26 | =head2 is_virtual |
27 | |
28 | Attribute to declare a view as virtual. |
29 | |
1d521afd |
30 | =head2 from |
31 | |
32 | Returns the FROM entry for the table (i.e. the view name) |
9774f48b |
33 | or the definition if this is a virtual view. |
1d521afd |
34 | |
35 | =cut |
36 | |
9774f48b |
37 | sub from { |
38 | my $self = shift; |
39 | return \"(${\$self->view_definition})" if $self->is_virtual; |
40 | return $self->name; |
41 | } |
1d521afd |
42 | |
43 | 1; |
44 | |
45 | =head1 AUTHORS |
46 | |
47 | Matt S. Trout <mst@shadowcatsystems.co.uk> |
48 | |
49 | With Contributions from: |
50 | |
51 | Guillermo Roditi E<lt>groditi@cpan.orgE<gt> |
52 | |
53 | =head1 LICENSE |
54 | |
55 | You may distribute this code under the same terms as Perl itself. |
56 | |
57 | =cut |
58 | |