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