On 11 Jun 2008, at 12:35, Adam Sjøgren wrote:

 Hi.

If I create a new row in the database, in a table that has an optional
foreign key, which isn't filled in in the create-call, and then call the
belongs_to relationship accessor on the resulting object, I get an
object back for the foreign key, when I use DBIx::Class 0.08008; I
didn't in 0.08007.

I am wondering whether this is expected behaviour?

Abbreviated example:

 # fleet_id not filled in when calling create:
 my $car2=$schema->resultset('CarDB::Car')->create({
                                                    id=>2,
                                                    plate=>'BBB 202',
                                                   });

 my $fleet2=$car2->fleet; # Searches fleet table with no WHERE clause
print defined $fleet2 ? "Fleet returned, car2\n" : "No fleet returned, car2\n";

prints "Fleet returned, car2" (full example below).

I have bisected my way to r3804 introducing this change, but I am not
exactly sure what the correct cure is, if it is indeed wrong.


This has been discussed on the mailinglist before, Damon Snyder asked
about it in:
<http://article.gmane.org/gmane.comp.lang.perl.modules.dbix-class/ 5331>
and mike provided a test-patch in:
<http://article.gmane.org/gmane.comp.lang.perl.modules.dbix-class/ 5443>.
The test-patch broke some other patches, so I posted an updated patch
that doesn't:
<http://article.gmane.org/gmane.comp.lang.perl.modules.dbix-class/ 5653>
It probably went unnoticed because of the age of the thread.


Hmm, seems like a bug to me.

Do you think you could convert your test suite to use the existing tables in the DBICTest schema (you can add a table or some rels if needed)?

-ash
_______________________________________________
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