[Dbix-class] What should DBIC objects stringify to?
Alan Humphrey
alan.humphrey at comcast.net
Wed May 3 17:00:50 CEST 2006
Ah. Thanks for setting me straight. And, in terms of the original query
->find( {pk1 => 'someval', pk2 => 'someotherval'})
should work for finding a row with a multi-part key. Yes?
-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of phaylon
Sent: Wednesday, May 03, 2006 7:55 AM
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] What should DBIC objects stringify to?
Alan Humphrey said:
>
> Perhaps:
>
> $obj = $schema->('Table')->find({whatever})->first;
> if ( $obj ) {
>
> } else {
>
> }
Won't do. ->find wants the primary key(s) and returns a row, not a
resultset, which would provide the ->first. So it's either
->search(...)->first, ->single(...) or ->find( $pk )
hth, p
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
More information about the Dbix-class
mailing list