X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate;a=blobdiff_plain;f=t%2Flib%2FDBSchema%2FResult%2FDvd.pm;h=0020109318b104d4a2b222c51bb3e78f02ce77f5;hp=d87147c24575e74695d65aec3a80a2ecaf8106c0;hb=34a44681170dc8a76ec09b1d655ed2c6d1d28e49;hpb=424363ed169eae916480670bea2363322285855a diff --git a/t/lib/DBSchema/Result/Dvd.pm b/t/lib/DBSchema/Result/Dvd.pm index d87147c..0020109 100644 --- a/t/lib/DBSchema/Result/Dvd.pm +++ b/t/lib/DBSchema/Result/Dvd.pm @@ -8,11 +8,10 @@ use warnings; use base 'DBIx::Class'; use overload '""' => sub {$_[0]->name}, fallback => 1; -use lib '../../DBIx-Class-HTML-FormFu/lib/'; -__PACKAGE__->load_components('Core'); +__PACKAGE__->load_components(qw/IntrospectableM2M Core/); __PACKAGE__->table('dvd'); __PACKAGE__->add_columns( - 'id' => { + 'dvd_id' => { data_type => 'integer', is_auto_increment => 1 }, @@ -40,17 +39,25 @@ __PACKAGE__->add_columns( data_type => 'datetime', is_nullable => 1, }, + 'twokeysfk' => { + data_type => 'integer', + is_nullable => 1, + }, ); -__PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to('owner', 'User', { id => 'owner' }); -__PACKAGE__->belongs_to('current_borrower', 'User', { id => 'current_borrower' }); -__PACKAGE__->has_many('dvdtags', 'Dvdtag', { 'foreign.dvd' => 'self.id' }); +__PACKAGE__->set_primary_key('dvd_id'); +__PACKAGE__->belongs_to('owner', 'DBSchema::Result::User', { id => 'owner' }); +__PACKAGE__->belongs_to('current_borrower', 'DBSchema::Result::User', { id => 'current_borrower' }); +__PACKAGE__->has_many('dvdtags', 'Dvdtag', { 'foreign.dvd' => 'self.dvd_id' }); +__PACKAGE__->has_many('viewings', 'DBSchema::Result::Viewing', { 'foreign.dvd_id' => 'self.dvd_id' }); __PACKAGE__->many_to_many('tags', 'dvdtags' => 'tag'); __PACKAGE__->might_have( liner_notes => 'DBSchema::Result::LinerNotes', undef, { proxy => [ qw/notes/ ] }, ); - +__PACKAGE__->add_relationship('like_has_many', 'DBSchema::Result::Twokeys', { 'foreign.dvd_name' => 'self.name' }, { accessor_name => 'like_has_many' } ); +__PACKAGE__->add_relationship('like_has_many2', 'DBSchema::Result::Twokeys_belongsto', + { 'foreign.key1' => 'self.twokeysfk' }, +); 1;