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 |
|