Lines 193-198
sub delete {
Link Here
|
193 |
return $self->_resultset->delete; |
193 |
return $self->_resultset->delete; |
194 |
} |
194 |
} |
195 |
|
195 |
|
|
|
196 |
=head3 update |
197 |
|
198 |
=cut |
199 |
|
200 |
sub update { |
201 |
my ($self, $params) = @_; |
202 |
|
203 |
my $no_triggers = delete $params->{no_triggers}; |
204 |
|
205 |
if ( |
206 |
!$no_triggers |
207 |
&& ( Class::Inspector->function_exists( $self->object_class, 'update' ) |
208 |
or Class::Inspector->function_exists( $self->object_class, 'store' ) ) |
209 |
) |
210 |
{ |
211 |
my $objects_updated; |
212 |
$self->_resultset->result_source->schema->txn_do( sub { |
213 |
while ( my $o = $self->next ) { |
214 |
$o->update($params); |
215 |
$objects_updated++; |
216 |
} |
217 |
}); |
218 |
return $objects_updated; |
219 |
} |
220 |
|
221 |
return $self->_resultset->update($params); |
222 |
} |
223 |
|
196 |
=head3 single |
224 |
=head3 single |
197 |
|
225 |
|
198 |
my $object = Koha::Objects->search({}, { rows => 1 })->single |
226 |
my $object = Koha::Objects->search({}, { rows => 1 })->single |
Lines 453-466
The autoload method is used call DBIx::Class method on a resultset.
Link Here
|
453 |
|
481 |
|
454 |
Important: If you plan to use one of the DBIx::Class methods you must provide |
482 |
Important: If you plan to use one of the DBIx::Class methods you must provide |
455 |
relevant tests in t/db_dependent/Koha/Objects.t |
483 |
relevant tests in t/db_dependent/Koha/Objects.t |
456 |
Currently count, is_paged, pager, update, result_class, single and slice are covered. |
484 |
Currently count, is_paged, pager, result_class, single and slice are covered. |
457 |
|
485 |
|
458 |
=cut |
486 |
=cut |
459 |
|
487 |
|
460 |
sub AUTOLOAD { |
488 |
sub AUTOLOAD { |
461 |
my ( $self, @params ) = @_; |
489 |
my ( $self, @params ) = @_; |
462 |
|
490 |
|
463 |
my @known_methods = qw( count is_paged pager update result_class single slice ); |
491 |
my @known_methods = qw( count is_paged pager result_class single slice ); |
464 |
my $method = our $AUTOLOAD; |
492 |
my $method = our $AUTOLOAD; |
465 |
$method =~ s/.*:://; |
493 |
$method =~ s/.*:://; |
466 |
|
494 |
|
467 |
- |
|
|