name => 'artist name',
});
+# the undef condition in this rel is *deliberate*
+# tests oddball legacy syntax
__PACKAGE__->has_many(
cds => 'DBICTest::Schema::CD', undef,
{ order_by => { -asc => 'year'} },
});
# in case this is a single-cd it promotes a track from another cd
-__PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track', 'single_track',
- { join_type => 'left'}
+__PACKAGE__->belongs_to( single_track => 'DBICTest::Schema::Track',
+ { 'foreign.trackid' => 'self.single_track' },
+ { join_type => 'left'},
);
# add a non-left single relationship for the complex prefetch tests
-__PACKAGE__->belongs_to( existing_single_track => 'DBICTest::Schema::Track', 'single_track');
+__PACKAGE__->belongs_to( existing_single_track => 'DBICTest::Schema::Track',
+ { 'foreign.trackid' => 'self.single_track' },
+);
__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track' );
__PACKAGE__->has_many(
cd_to_producer => 'DBICTest::Schema::CD_to_Producer' => 'cd'
);
+# the undef condition in this rel is *deliberate*
+# tests oddball legacy syntax
__PACKAGE__->might_have(
liner_notes => 'DBICTest::Schema::LinerNotes', undef,
{ proxy => [ qw/notes/ ] },
);
__PACKAGE__->belongs_to('genre', 'DBICTest::Schema::Genre',
- { 'foreign.genreid' => 'self.genreid' },
+ 'genreid',
{
join_type => 'left',
on_delete => 'SET NULL',
);
__PACKAGE__->set_primary_key(qw/cd producer/);
+# the undef condition in this rel is *deliberate*
+# tests oddball legacy syntax
__PACKAGE__->belongs_to(
- 'cd', 'DBICTest::Schema::CD',
- { 'foreign.cdid' => 'self.cd' }
+ 'cd', 'DBICTest::Schema::CD'
);
__PACKAGE__->belongs_to(
# Normally this would not appear as a FK constraint
# since it uses the PK
-__PACKAGE__->might_have('artist_1', 'DBICTest::Schema::Artist',
- { 'foreign.artistid' => 'self.artist' },
+__PACKAGE__->might_have('artist_1', 'DBICTest::Schema::Artist', 'artistid',
{ is_foreign_key_constraint => 1 },
);
__PACKAGE__->position_column ('position');
__PACKAGE__->grouping_column ('cd');
-
+# the undef condition in this rel is *deliberate*
+# tests oddball legacy syntax
__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD', undef, {
proxy => { cd_title => 'title' },
});
__PACKAGE__->belongs_to(
"year1999cd",
"DBICTest::Schema::Year1999CDs",
- { "foreign.cdid" => "self.cd" },
+ 'cd',
{ join_type => 'left' }, # the relationship is of course optional
);
__PACKAGE__->belongs_to(
"year2000cd",
"DBICTest::Schema::Year2000CDs",
- { "foreign.cdid" => "self.cd" },
+ 'cd',
{ join_type => 'left' },
);
__PACKAGE__->add_unique_constraint([ qw/artist title/ ]);
__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' );
-__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track',
- { "foreign.cd" => "self.cdid" });
+__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', 'cd' );
1;
));
__PACKAGE__->belongs_to( artist => 'DBICTest::Schema::Artist' );
-__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track',
- { "foreign.cd" => "self.cdid" });
+__PACKAGE__->has_many( tracks => 'DBICTest::Schema::Track', 'cd' );
1;