From: Nigel Metheringham Date: Sun, 26 Oct 2008 11:59:35 +0000 (+0000) Subject: Modified example to use load_namespace with default naming rather than load_classes X-Git-Tag: v0.08240~299^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2c69732158b0e65bcccfe6c2b9912082c62dd90e;p=dbsrgits%2FDBIx-Class.git Modified example to use load_namespace with default naming rather than load_classes --- diff --git a/t/examples/Schema/MyDatabase/Main.pm b/t/examples/Schema/MyDatabase/Main.pm index 6b9eef7..42fae1b 100644 --- a/t/examples/Schema/MyDatabase/Main.pm +++ b/t/examples/Schema/MyDatabase/Main.pm @@ -1,5 +1,5 @@ package MyDatabase::Main; use base qw/DBIx::Class::Schema/; -__PACKAGE__->load_classes(qw/Artist Cd Track/); +__PACKAGE__->load_namespaces; 1; diff --git a/t/examples/Schema/MyDatabase/Main/Artist.pm b/t/examples/Schema/MyDatabase/Main/Result/Artist.pm similarity index 65% rename from t/examples/Schema/MyDatabase/Main/Artist.pm rename to t/examples/Schema/MyDatabase/Main/Result/Artist.pm index 5f039e6..ec78501 100644 --- a/t/examples/Schema/MyDatabase/Main/Artist.pm +++ b/t/examples/Schema/MyDatabase/Main/Result/Artist.pm @@ -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; diff --git a/t/examples/Schema/MyDatabase/Main/Cd.pm b/t/examples/Schema/MyDatabase/Main/Result/Cd.pm 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 --- a/t/examples/Schema/MyDatabase/Main/Cd.pm +++ b/t/examples/Schema/MyDatabase/Main/Result/Cd.pm @@ -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; diff --git a/t/examples/Schema/MyDatabase/Main/Track.pm b/t/examples/Schema/MyDatabase/Main/Result/Track.pm similarity index 65% rename from t/examples/Schema/MyDatabase/Main/Track.pm rename to t/examples/Schema/MyDatabase/Main/Result/Track.pm index 3710406..23877bb 100644 --- a/t/examples/Schema/MyDatabase/Main/Track.pm +++ b/t/examples/Schema/MyDatabase/Main/Result/Track.pm @@ -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;