if ($attributes) {
$self->{_result} =
- Koha::Database->new()->schema()->resultset( $class->type() )
+ Koha::Database->new()->schema()->resultset( $class->_type() )
->new($attributes);
}
- croak("No type found! Koha::Object must be subclassed!")
- unless $class->type();
+ croak("No _type found! Koha::Object must be subclassed!")
+ unless $class->_type();
bless( $self, $class );
# DBIC result row
$self->{_result} = $dbic_row;
- croak("No type found! Koha::Object must be subclassed!")
- unless $class->type();
+ croak("No _type found! Koha::Object must be subclassed!")
+ unless $class->_type();
- croak( "DBIC result type " . ref( $self->{_result} ) . " isn't of the type " . $class->type() )
- unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->type();
+ croak( "DBIC result _type " . ref( $self->{_result} ) . " isn't of the _type " . $class->_type() )
+ unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->_type();
bless( $self, $class );
# If we don't have a dbic row at this point, we need to create an empty one
$self->{_result} ||=
- Koha::Database->new()->schema()->resultset( $self->type() )->new({});
+ Koha::Database->new()->schema()->resultset( $self->_type() )->new({});
return $self->{_result};
}
return;
}
-=head3 type
+=head3 _type
This method must be defined in the child class. The value is the name of the DBIC resultset.
-For example, for borrowers, the type method will return "Borrower".
+For example, for borrowers, the _type method will return "Borrower".
=cut
-sub type { }
+sub _type { }
sub DESTROY { }