[Dbix-class] RFC: What to do with $resultset->single returning multiple rows?

Zbigniew Lukasiak zzbbyy at gmail.com
Tue May 6 06:43:52 BST 2008


Hi,

I am affraid I am responsible for that - so here is the explanation of
what I did.  The problem it is trying to fix is in t/61findnot.t:

$cd = $schema->resultset("CD")->first;
my $artist_rs = $schema->resultset("Artist")->search({ artistid =>
$cd->artist->artistid });
$art = $artist_rs->find({ name => 'some other name' }, { key => 'primary' });
ok($art, 'Artist found by key in the resultset');

So this was a fix for find - but internally find uses ->single - so I
had to change that method as well.  There were not tests for ->single.

I think I would go for option 1 - my understanding is tht ->single is
actually optimisation for ->find.

I am sorry for the introduced but,
Zbigniew



More information about the DBIx-Class mailing list