View | Details | Raw Unified | Return to bug 18361
Collapse All | Expand All

(-)a/Koha/Objects.pm (-5 / +11 lines)
Lines 70-88 sub _new_from_dbic { Link Here
70
70
71
=head3 Koha::Objects->find();
71
=head3 Koha::Objects->find();
72
72
73
my $object = Koha::Objects->find($id);
73
Similar to DBIx::Class::ResultSet->find this method accepts:
74
my $object = Koha::Objects->find( { keypart1 => $keypart1, keypart2 => $keypart2 } );
74
    \%columns_values | @pk_values, { key => $unique_constraint, %attrs }?
75
Strictly speaking, columns_values should only refer to columns under an
76
unique constraint.
77
78
my $object = Koha::Objects->find( { col1 => $val1, col2 => $val2 } );
79
my $object = Koha::Objects->find( $id );
80
my $object = Koha::Objects->find( $idpart1, $idpart2, $attrs ); # composite PK
75
81
76
=cut
82
=cut
77
83
78
sub find {
84
sub find {
79
    my ( $self, $id ) = @_;
85
    my ( $self, @pars ) = @_;
80
86
81
    croak 'Cannot use "->find" in list context' if wantarray;
87
    croak 'Cannot use "->find" in list context' if wantarray;
82
88
83
    return unless defined($id);
89
    return unless @pars;
84
90
85
    my $result = $self->_resultset()->find($id);
91
    my $result = $self->_resultset()->find( @pars );
86
92
87
    return unless $result;
93
    return unless $result;
88
94
(-)a/t/lib/TestBuilder.pm (-2 / +1 lines)
Lines 74-80 sub build_object { Link Here
74
    my @ids;
74
    my @ids;
75
75
76
    foreach my $pk ( @pks ) {
76
    foreach my $pk ( @pks ) {
77
        push @ids, { $pk => $hashref->{ $pk } };
77
        push @ids, $hashref->{ $pk };
78
    }
78
    }
79
79
80
    my $object = $class->find( @ids );
80
    my $object = $class->find( @ids );
81
- 

Return to bug 18361