},
deflate => sub {
my ($val, $self) = @_;
- $self->throw_exception("$val isn't a $f_class") unless $val->isa($f_class);
+ $self->throw_exception("$val isn't a $f_class")
+ unless $val->isa($self->result_source->schema->class($f_class));
return ($val->_ident_values)[0];
# WARNING: probably breaks for multi-pri sometimes. FIXME
}
resultset.
=cut
-
+
sub search_literal {
my ($self, $cond, @vals) = @_;
my $attrs = (ref $vals[$#vals] eq 'HASH' ? { %{ pop(@vals) } } : {});
Also takes an optional C<key> attribute, to search by a specific key or unique
constraint. For example:
- my $cd = $schema->resultset('CD')->find_or_create(
+ my $cd = $schema->resultset('CD')->find(
{
artist => 'Massive Attack',
title => 'Mezzanine',
$class->find_or_create({ key => $val, ... });
-Searches for a record matching the search condition; if it doesn't find one,
-creates one and returns that instead.
+Searches for a record matching the search condition; if it doesn't find one,
+creates one and returns that instead.
my $cd = $schema->resultset('CD')->find_or_create({
cdid => 5,
]
],
{ 'mother.person_id' => 'child.mother_id' }
- ],
+ ],
]
},
);