Now - this is rather pathological example - but if you have a
belongs_to relation and no has_many relation from the other side then
related object creation blows.
Here is the verbatim test I wrote for it (against the DBICTest schema,
Bookmark has a belongs_to relation, Link has no defined relations):

 my $new_bookmark = $schema->resultset("Bookmark")->new_result( {} );
 my $new_related_link = $new_bookmark->new_related( 'link', {} );

This dies with:

Can't use an undefined value as a HASH reference at
/home/zl/progs/DBIC/lib/DBIx/Class/ResultSet.pm line 1569.


I am attaching a simple fix for that with the test - but I am aware
that it is just a surface fix. It shows that the code expects that the
relations are always in pairs - maybe it needs to be documented?


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

Attachment: no_back_rels.diff
Description: Binary data

_______________________________________________
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