[Bast-commits] r4770 - in DBIx-Class/0.08/branches/view_support: lib/DBIx/Class/Core lib/DBIx/Class/ResultSource lib/DBIx/Class/ResultSourceProxy t/lib/DBICTest/Schema

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Mon Aug 25 22:17:12 BST 2008


Author: matthewt
Date: 2008-08-25 22:17:12 +0100 (Mon, 25 Aug 2008)
New Revision: 4770

Removed:
   DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/Core/View.pm
   DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSourceProxy/View.pm
Modified:
   DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSource/View.pm
   DBIx-Class/0.08/branches/view_support/t/lib/DBICTest/Schema/Year2000CDs.pm
Log:
delete Core::View and ResultSourceProxy::View, fix ResultSource::View

Deleted: DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/Core/View.pm
===================================================================
--- DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/Core/View.pm	2008-08-25 20:17:49 UTC (rev 4769)
+++ DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/Core/View.pm	2008-08-25 21:17:12 UTC (rev 4770)
@@ -1,65 +0,0 @@
-package DBIx::Class::Core::View;
-
-use strict;
-use warnings;
-no warnings 'qw';
-
-use base qw/DBIx::Class/;
-
-__PACKAGE__->load_components(qw/
-  Relationship
-  InflateColumn
-  PK::Auto
-  PK
-  Row
-  ResultSourceProxy::View/);
-
-1;
-
-=head1 NAME
-
-DBIx::Class::Core - Core set of DBIx::Class modules
-
-=head1 SYNOPSIS
-
-  # In your result classes
-  __PACKAGE__->load_components(qw/Core::View/);
-
-=head1 DESCRIPTION
-
-This class just inherits from the various modules that make up the
-L<DBIx::Class> core features.  You almost certainly want these.
-
-The core modules currently are:
-
-=over 4
-
-=item L<DBIx::Class::Serialize::Storable>
-
-=item L<DBIx::Class::InflateColumn>
-
-=item L<DBIx::Class::Relationship>
-
-=item L<DBIx::Class::PK::Auto>
-
-=item L<DBIx::Class::PK>
-
-=item L<DBIx::Class::Row>
-
-=item L<DBIx::Class::ResultSourceProxy::View>
-
-=back
-
-=head1 AUTHORS
-
-Matt S. Trout <mst at shadowcatsystems.co.uk>
-
-With Contributions from:
-
-Guillermo Roditi E<lt>groditi at cpan.orgE<gt>
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut

Modified: DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSource/View.pm
===================================================================
--- DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSource/View.pm	2008-08-25 20:17:49 UTC (rev 4769)
+++ DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSource/View.pm	2008-08-25 21:17:12 UTC (rev 4770)
@@ -7,7 +7,9 @@
 
 use base qw/DBIx::Class/;
 __PACKAGE__->load_components(qw/ResultSource/);
-__PACKAGE__->mk_group_accessors('simple' => ' is_virtual');
+__PACKAGE__->mk_group_accessors(
+  'simple' => qw(is_virtual view_definition)
+);
 
 =head1 NAME
 

Deleted: DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSourceProxy/View.pm
===================================================================
--- DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSourceProxy/View.pm	2008-08-25 20:17:49 UTC (rev 4769)
+++ DBIx-Class/0.08/branches/view_support/lib/DBIx/Class/ResultSourceProxy/View.pm	2008-08-25 21:17:12 UTC (rev 4770)
@@ -1,144 +0,0 @@
-package DBIx::Class::ResultSourceProxy::View;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::ResultSourceProxy/;
-
-use DBIx::Class::ResultSource::View;
-
-__PACKAGE__->mk_classdata(view_class => 'DBIx::Class::ResultSource::View');
-
-__PACKAGE__->mk_classdata('view_definition');
-__PACKAGE__->mk_classdata('view_alias'); # FIXME: Doesn't actually do
-                                          # anything yet!
-
-sub _init_result_source_instance {
-    my $class = shift;
-
-    $class->mk_classdata('result_source_instance')
-        unless $class->can('result_source_instance');
-
-    my $view = $class->result_source_instance;
-    my $class_has_view_instance = ($view and $view->result_class eq $class);
-    return $view if $class_has_view_instance;
-
-    if( $view ) {
-        $view = $class->view_class->new({
-            %$view,
-            result_class => $class,
-            source_name => undef,
-            schema => undef
-        });
-    }
-    else {
-        $view = $class->view_class->new({
-            name            => undef,
-            result_class    => $class,
-            source_name     => undef,
-        });
-    }
-
-    $class->result_source_instance($view);
-
-    if ($class->can('schema_instance')) {
-        $class =~ m/([^:]+)$/;
-        $class->schema_instance->register_class($class, $class);
-    }
-
-    return $view;
-}
-
-=head1 NAME
-
-DBIx::Class::ResultSourceProxy::View - provides a classdata view
-object and method proxies
-
-=head1 SYNOPSIS
-
-  #optional, for deploy support
-  __PACKAGE__->view_definition('SELECT cdid, artist, title, year FROM foo');
-
-  __PACKAGE__->view('cd');
-  __PACKAGE__->add_columns(qw/cdid artist title year/);
-  __PACKAGE__->set_primary_key('cdid');
-
-=head1 METHODS
-
-=head2 add_columns
-
-  __PACKAGE__->add_columns(qw/cdid artist title year/);
-
-Adds columns to the current class and creates accessors for them.
-
-=cut
-
-=head2 view
-
-  __PACKAGE__->view('view_name');
-  
-Gets or sets the view name.
-
-=cut
-
-sub view {
-  my ($class, $view) = @_;
-  return $class->result_source_instance->name unless $view;
-  unless (ref $view) {
-    $view = $class->view_class->new({
-        $class->can('result_source_instance') ?
-          %{$class->result_source_instance||{}} : (),
-        name => $view,
-        result_class => $class,
-        source_name => undef,
-    });
-  }
-
-  $class->mk_classdata('result_source_instance')
-    unless $class->can('result_source_instance');
-
-  $class->result_source_instance($view);
-
-  if ($class->can('schema_instance')) {
-    $class =~ m/([^:]+)$/;
-    $class->schema_instance->register_class($class, $class);
-  }
-  return $class->result_source_instance->name;
-}
-
-=head2 has_column
-
-  if ($obj->has_column($col)) { ... }
-
-Returns 1 if the class has a column of this name, 0 otherwise.
-
-=cut
-
-=head2 column_info
-
-  my $info = $obj->column_info($col);
-
-Returns the column metadata hashref for a column. For a description of
-the various types of column data in this hashref, see
-L<DBIx::Class::ResultSource/add_column>
-
-=cut
-
-=head2 columns
-
-  my @column_names = $obj->columns;
-
-=cut
-
-1;
-
-=head1 AUTHORS
-
-Matt S. Trout <mst at shadowcatsystems.co.uk>
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut
-

Modified: DBIx-Class/0.08/branches/view_support/t/lib/DBICTest/Schema/Year2000CDs.pm
===================================================================
--- DBIx-Class/0.08/branches/view_support/t/lib/DBICTest/Schema/Year2000CDs.pm	2008-08-25 20:17:49 UTC (rev 4769)
+++ DBIx-Class/0.08/branches/view_support/t/lib/DBICTest/Schema/Year2000CDs.pm	2008-08-25 21:17:12 UTC (rev 4770)
@@ -1,10 +1,15 @@
 package # hide from PAUSE 
     DBICTest::Schema::Year2000CDs;
 
-use base 'DBIx::Class::Core::View';
+use base 'DBIx::Class::Core';
+use DBIx::Class::ResultSource::View;
 
-__PACKAGE__->view('cd');
-__PACKAGE__->view_definition("SELECT cdid, artist, title FROM cd WHERE year ='2000'");
+__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
+
+__PACKAGE__->table('cd');
+__PACKAGE__->result_source_instance->view_definition(
+  "SELECT cdid, artist, title FROM cd WHERE year ='2000'"
+);
 __PACKAGE__->add_columns(
   'cdid' => {
     data_type => 'integer',




More information about the Bast-commits mailing list