From: Kennedy Clark Date: Mon, 29 Dec 2008 21:10:24 +0000 (+0000) Subject: Comment on how to do more advanced stuff with DBIC and provide links; also add back... X-Git-Tag: v5.8005~231 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=c93b5eaafedcb01e21120d85cf1ab836b8876c32;hp=cf582e91b80f0002a576fd6c01cb571311cb609f Comment on how to do more advanced stuff with DBIC and provide links; also add back a sentence on DBIC terminology that somehow got deleted a long time ago. --- diff --git a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod index b5ac7bd..9f24c9c 100644 --- a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod @@ -602,8 +602,12 @@ to C. Because we specified C to the helper, it use L to dynamically load the schema information from the database every time -the application starts. And finally, C is the -standard DBI connect string for use with SQLite. +the application starts. DBIC uses the schema to load other classes +that represent the tables in your database (DBIC refers to these +"table objects" as "result sources," see +L). And finally, +C is the standard DBI connect string for use with +SQLite. B Although the C option to the DBIC helper makes for a nifty demonstration, is only really suitable for very @@ -639,9 +643,27 @@ C<[$c-Emodel('DB::Books')-Eall]> and delete the next 2 lines): $c->stash->{template} = 'books/list.tt2'; } -B: You may see the C<$c-Emodel('DB::Book')> un-commented above -written as C<$c-Emodel('DB')-Eresultset('Book')>. The two -are equivalent. + +B: You may see the C<$c-Emodel('DB::Book')> un-commented +above written as C<$c-Emodel('DB')-Eresultset('Book')>. The +two are equivalent. Either way, C<$c-Emodel> returns a +L which handles queries +against the database and iterating over the set of results that are +returned. + +We are using the C<-Eall> to fetch all of the books. DBIC +supports a wide variety of more advanced operations to easily do +things like filtering and sorting the results. For example, the +following could be used to sort the results by desending title: + + $c->model('DB::Books')->search({}, {order_by => 'title DESC'}); + +Some other examples are provided in +L, with +additional information found at L, +L, +L +and L. =head2 Test Run The Application