Bug 21610: (QA follow-up) Better use columns_info from DBIx
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 19 Oct 2018 09:05:50 +0000 (11:05 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 4 Feb 2019 11:13:10 +0000 (11:13 +0000)
We should better use the published method than a private hash key.
And shorter to go via _result than adding a new schema call.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 8625eefc76a9390e28e9136f19b9767814bc27a5)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/Object.pm

index 65790eb..d388ead 100644 (file)
@@ -121,8 +121,7 @@ Returns:
 sub store {
     my ($self) = @_;
 
-    my $columns_info = Koha::Database->new->schema->resultset( $self->_type )
-        ->result_source->{_columns};
+    my $columns_info = $self->_result->result_source->columns_info;
 
     # Handle not null and default values for integers and dates
     foreach my $col ( keys %{$columns_info} ) {