On Jan 16, 2008, at 9:02 AM, Zbigniew Lukasiak wrote:
Hi all
This is a continuation of the "patch for ResultSet::find_or_new"
thread - but it's also a subject on it's own.
It is my understanding that:
$schema->resultset("Artist")->find({name => 'Random Girl Band'}, {key
=> 'primary'});
should never find anything - because it should search by the primary
key that is not included in the search conditions. And I believe I am
not alone in this interpretation of the documentation - see for
example Matt's words:
The usual use of find_or_new is to pass a unique key plus additional
attributes to be used for object creation (which are ignored in the
find()
by specifying the key attr as well).
But if there is a row with name == 'Random Girl Band' then it will
find it. To prove that I attach a patch for the t/61findnot.t test.
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
<61findnot.diff>_______________________________________________
Seems sensible to me - the patch shows the behaviour I would *expect*.
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]