Hi,

I've started the testing and I found out that add_relationship does
not create the accessor on  the row objects (or maybe I am missing
something - but then I volunteer to do the doc patch).  I think this
is not new.

A test diff is attached - here is what it contains:

In CD.pm:

__PACKAGE__->add_relationship('genre_new_rel', 'DBICTest::Schema::Genre',
    { 'foreign.genreid' => 'self.genreid' },
    { 'accessor' => 'single' }
);

I have the impression that this should create the accessor on the row object.

But this test fails:

ok( $cd->can( 'genre_new_rel' ), 'Genre accessor created' );


Cheers,
Zbigniew Lukasiak
Index: t/66relationship.t
===================================================================
--- t/66relationship.t	(revision 5350)
+++ t/66relationship.t	(working copy)
@@ -12,6 +12,8 @@
 
 # has_a test
 my $cd = $schema->resultset("CD")->find(4);
+ok( $cd->can( 'genre_new_rel' ), 'Genre accessor created' );
+
 my ($artist) = ($INC{'DBICTest/HelperRels'}
                   ? $cd->artist
                   : $cd->search_related('artist'));
Index: t/lib/DBICTest/Schema/CD.pm
===================================================================
--- t/lib/DBICTest/Schema/CD.pm	(revision 5350)
+++ t/lib/DBICTest/Schema/CD.pm	(working copy)
@@ -83,9 +83,9 @@
 );
 
 
-#__PACKAGE__->add_relationship('genre', 'DBICTest::Schema::Genre',
-#    { 'foreign.genreid' => 'self.genreid' },
-#    { 'accessor' => 'single' }
-#);
+__PACKAGE__->add_relationship('genre_new_rel', 'DBICTest::Schema::Genre',
+    { 'foreign.genreid' => 'self.genreid' },
+    { 'accessor' => 'single' }
+);
 
 1;
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to