From d5dd71661d47f8aa6c9864762a46171eb110057e Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 7 Sep 2017 16:18:26 +0100 Subject: [PATCH] Fix inflation of booleans from database --- lib/Pear/LocalLoop/Schema/Result/Organisation.pm | 11 ----------- lib/Pear/LocalLoop/Schema/Result/User.pm | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/lib/Pear/LocalLoop/Schema/Result/Organisation.pm b/lib/Pear/LocalLoop/Schema/Result/Organisation.pm index aa75de7..7f6c4c8 100644 --- a/lib/Pear/LocalLoop/Schema/Result/Organisation.pm +++ b/lib/Pear/LocalLoop/Schema/Result/Organisation.pm @@ -70,7 +70,6 @@ __PACKAGE__->belongs_to( __PACKAGE__->filter_column( pending => { filter_to_storage => 'to_bool', - filter_from_storage => 'from_bool', }); # Only works when calling ->deploy, but atleast helps for tests @@ -94,14 +93,4 @@ sub to_bool { } } -sub from_bool { - my ( $self, $val ) = @_; - my $driver_name = $self->result_source->schema->storage->dbh->{Driver}->{Name}; - if ( $driver_name eq 'SQLite' ) { - return $val; - } else { - return lc $val eq 'true' ? 1 : 0; - } -} - 1; diff --git a/lib/Pear/LocalLoop/Schema/Result/User.pm b/lib/Pear/LocalLoop/Schema/Result/User.pm index b5457c5..162fa12 100644 --- a/lib/Pear/LocalLoop/Schema/Result/User.pm +++ b/lib/Pear/LocalLoop/Schema/Result/User.pm @@ -90,7 +90,6 @@ sub sqlt_deploy_hook { __PACKAGE__->filter_column( is_admin => { filter_to_storage => 'to_bool', - filter_from_storage => 'from_bool', }); sub to_bool { @@ -103,16 +102,6 @@ sub to_bool { } } -sub from_bool { - my ( $self, $val ) = @_; - my $driver_name = $self->result_source->schema->storage->dbh->{Driver}->{Name}; - if ( $driver_name eq 'SQLite' ) { - return $val; - } else { - return lc $val eq 'true' ? 1 : 0; - } -} - sub generate_session { my $self = shift;