[Catalyst-commits] r10005 -
Catalyst-Manual/5.70/branches/depluralise/lib/Catalyst/Manual/Tutorial
kiffin at dev.catalyst.perl.org
kiffin at dev.catalyst.perl.org
Mon May 4 21:02:14 GMT 2009
Author: kiffin
Date: 2009-05-04 21:02:14 +0000 (Mon, 04 May 2009)
New Revision: 10005
Modified:
Catalyst-Manual/5.70/branches/depluralise/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod
Log:
Coorected the table names to use singular words as the recommended naming convention.
Modified: Catalyst-Manual/5.70/branches/depluralise/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod
===================================================================
--- Catalyst-Manual/5.70/branches/depluralise/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod 2009-05-04 20:22:03 UTC (rev 10004)
+++ Catalyst-Manual/5.70/branches/depluralise/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod 2009-05-04 21:02:14 UTC (rev 10005)
@@ -273,7 +273,7 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
- # $c->stash->{books} = [$c->model('DB::Books')->all];
+ # $c->stash->{books} = [$c->model('DB::Book')->all];
# But, for now, use this code until we create the model later
$c->stash->{books} = '';
@@ -837,7 +837,7 @@
Open C<lib/MyApp/Controller/Books.pm> and un-comment the model code we
left disabled earlier so that your version matches the following (un-
-comment the line containing C<[$c-E<gt>model('DB::Books')-E<gt>all]>
+comment the line containing C<[$c-E<gt>model('DB::Book')-E<gt>all]>
and delete the next 2 lines):
=head2 list
@@ -854,7 +854,7 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
- $c->stash->{books} = [$c->model('DB::Books')->all];
+ $c->stash->{books} = [$c->model('DB::Book')->all];
# Set the TT template to use. You will almost always want to do this
# in your action methods (action methods respond to user input in
@@ -862,7 +862,7 @@
$c->stash->{template} = 'books/list.tt2';
}
-B<TIP>: You may see the C<$c-E<gt>model('DB::Books')> un-commented
+B<TIP>: You may see the C<$c-E<gt>model('DB::Book')> un-commented
above written as C<$c-E<gt>model('DB')-E<gt>resultset('Books')>. The
two are equivalent. Either way, C<$c-E<gt>model> returns a
L<DBIx::Class::ResultSet|DBIx::Class::ResultSet> which handles queries
@@ -874,7 +874,7 @@
things like filtering and sorting the results. For example, the
following could be used to sort the results by descending title:
- $c->model('DB::Books')->search({}, {order_by => 'title DESC'});
+ $c->model('DB::Book')->search({}, {order_by => 'title DESC'});
Some other examples are provided in
L<DBIx::Class::Manual::Cookbook/Complex WHERE clauses>, with
@@ -927,9 +927,9 @@
| MyApp::Controller::Books | instance |
| MyApp::Controller::Root | instance |
| MyApp::Model::DB | instance |
- | MyApp::Model::DB::Authors | class |
- | MyApp::Model::DB::BookAuthors | class |
- | MyApp::Model::DB::Books | class |
+ | MyApp::Model::DB::Author | class |
+ | MyApp::Model::DB::BookAuthor | class |
+ | MyApp::Model::DB::Book | class |
| MyApp::View::TT | instance |
'-----------------------------------------------------------------+----------'
@@ -972,8 +972,8 @@
Catalyst::Model::DBIC::Schema dynamically created three model classes,
one to represent each of the three tables in our database
-(C<MyApp::Model::DB::Authors>, C<MyApp::Model::DB::BookAuthors>,
-and C<MyApp::Model::DB::Books>).
+(C<MyApp::Model::DB::Author>, C<MyApp::Model::DB::BookAuthor>,
+and C<MyApp::Model::DB::Book>).
=item *
@@ -1194,7 +1194,7 @@
# 1) Name of relationship, DBIC will create accessor with this name
# 2) Name of the model class referenced by this relationship
# 3) Column name in *foreign* table (aka, foreign key in peer table)
- __PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthors', 'book_id');
+ __PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthor', 'book_id');
# many_to_many():
# args:
@@ -1247,7 +1247,7 @@
# 1) Name of relationship, DBIC will create an accessor with this name
# 2) Name of the model class referenced by this relationship
# 3) Column name in *foreign* table (aka, foreign key in peer table)
- __PACKAGE__->has_many(book_author => 'MyApp::Schema::Result::BookAuthors', 'author_id');
+ __PACKAGE__->has_many(book_author => 'MyApp::Schema::Result::BookAuthor', 'author_id');
# many_to_many():
# args:
@@ -1269,14 +1269,14 @@
# 1) Name of relationship, DBIC will create accessor with this name
# 2) Name of the model class referenced by this relationship
# 3) Column name in *this* table
- __PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Books', 'book_id');
+ __PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Book', 'book_id');
# belongs_to():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
# 2) Name of the model class referenced by this relationship
# 3) Column name in *this* table
- __PACKAGE__->belongs_to(author => 'MyApp::Schema::Result::Authors', 'author_id');
+ __PACKAGE__->belongs_to(author => 'MyApp::Schema::Result::Author', 'author_id');
=head2 Run The Application
@@ -1464,7 +1464,7 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
- $c->stash->{books} = [$c->model('DB::Books')->all];
+ $c->stash->{books} = [$c->model('DB::Book')->all];
# Set the TT template to use. You will almost always want to do this
# in your action methods (actions methods respond to user input in
More information about the Catalyst-commits
mailing list