in reply to Re^5: Catalyst: model & context object usage
in thread Catalyst: model & context object usage
package MyApp::Schema::Books; use strict; use warnings; use base 'DBIx::Class'; __PACKAGE__->load_components("Core"); __PACKAGE__->table("books"); __PACKAGE__->add_columns( "id", { data_type => "NUMBER", default_value => undef, is_nullable => 0, s +ize => 38 }, "title", { data_type => "VARCHAR2", default_value => undef, is_nullable => 1, size => 100, }, "rating", { data_type => "NUMBER", default_value => undef, is_nullable => 1, s +ize => 38 }, ); __PACKAGE__->set_primary_key("id"); # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-08-07 17:34:1 +2 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:t8NDS4p6epEhWCyorZl93Q # You can replace this text with custom content, and it will be preser +ved on regeneration # # Set relationships; # # has_many(): # 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 *foreign* table __PACKAGE__->has_many(book_authors => 'MyApp::Schema::BookAuthors', 'b +ook_id'); # many_to_many(): # args: # 1) Name of relationship, DBIC will create accessor with this n +ame # 2) Name of has_many() relationship this many_to_many() is shor +tcut for # 3) Name of belongs_to() relationship in model class of has_man +y() above # You must already have the has_many() defined to use a many_to_ +many(). __PACKAGE__->many_to_many(authors => 'book_authors', 'author'); 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Catalyst: model & context object usage
by actualize (Monk) on Aug 12, 2008 at 02:22 UTC | |
by marscld (Beadle) on Aug 12, 2008 at 05:42 UTC | |
by actualize (Monk) on Aug 12, 2008 at 07:09 UTC | |
by marscld (Beadle) on Aug 13, 2008 at 01:35 UTC |