Modified example to use load_namespace with default naming rather than load_classes
Nigel Metheringham [Sun, 26 Oct 2008 11:59:35 +0000 (11:59 +0000)]
t/examples/Schema/MyDatabase/Main.pm
t/examples/Schema/MyDatabase/Main/Result/Artist.pm [moved from t/examples/Schema/MyDatabase/Main/Artist.pm with 65% similarity]
t/examples/Schema/MyDatabase/Main/Result/Cd.pm [moved from t/examples/Schema/MyDatabase/Main/Cd.pm with 51% similarity]
t/examples/Schema/MyDatabase/Main/Result/Track.pm [moved from t/examples/Schema/MyDatabase/Main/Track.pm with 65% similarity]

index 6b9eef7..42fae1b 100644 (file)
@@ -1,5 +1,5 @@
 package MyDatabase::Main;
 use base qw/DBIx::Class::Schema/;
-__PACKAGE__->load_classes(qw/Artist Cd Track/);
+__PACKAGE__->load_namespaces;
 
 1;
@@ -1,10 +1,10 @@
-package MyDatabase::Main::Artist;
+package MyDatabase::Main::Result::Artist;
 use base qw/DBIx::Class/;
 __PACKAGE__->load_components(qw/PK::Auto Core/);
 __PACKAGE__->table('artist');
 __PACKAGE__->add_columns(qw/ artistid name /);
 __PACKAGE__->set_primary_key('artistid');
-__PACKAGE__->has_many('cds' => 'MyDatabase::Main::Cd');
+__PACKAGE__->has_many('cds' => 'MyDatabase::Main::Result::Cd');
 
 1;
 
similarity index 51%
rename from t/examples/Schema/MyDatabase/Main/Cd.pm
rename to t/examples/Schema/MyDatabase/Main/Result/Cd.pm
index 4579823..83fd21e 100644 (file)
@@ -1,10 +1,10 @@
-package MyDatabase::Main::Cd;
+package MyDatabase::Main::Result::Cd;
 use base qw/DBIx::Class/;
 __PACKAGE__->load_components(qw/PK::Auto Core/);
 __PACKAGE__->table('cd');
 __PACKAGE__->add_columns(qw/ cdid artist title/);
 __PACKAGE__->set_primary_key('cdid');
-__PACKAGE__->belongs_to('artist' => 'MyDatabase::Main::Artist');
-__PACKAGE__->has_many('tracks' => 'MyDatabase::Main::Track');
+__PACKAGE__->belongs_to('artist' => 'MyDatabase::Main::Result::Artist');
+__PACKAGE__->has_many('tracks' => 'MyDatabase::Main::Result::Track');
 
 1;
@@ -1,9 +1,9 @@
-package MyDatabase::Main::Track;
+package MyDatabase::Main::Result::Track;
 use base qw/DBIx::Class/;
 __PACKAGE__->load_components(qw/PK::Auto Core/);
 __PACKAGE__->table('track');
 __PACKAGE__->add_columns(qw/ trackid cd title/);
 __PACKAGE__->set_primary_key('trackid');
-__PACKAGE__->belongs_to('cd' => 'MyDatabase::Main::Cd');
+__PACKAGE__->belongs_to('cd' => 'MyDatabase::Main::Result::Cd');
 
 1;