[Koha-bugs] [Bug 13019] Add base classes on which to build Koha objects

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 25 06:53:48 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13019

--- Comment #47 from David Cook <dcook at prosentient.com.au> ---
Comment on attachment 33846
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=33846
Bug 13019 - Add base classes on which to build Koha objects

Review of attachment 33846:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=13019&attachment=33846)
-----------------------------------------------------------------

::: Koha/Object.pm
@@ +136,5 @@
> +=head3 $object->delete();
> +
> +Removes the object from storage.
> +
> +Returns:

I can see returning true on success, but shouldn't we throw an exception if the
deletion fails or if the object was never in storage?

I would think it would make more sense to try a proper exception using die(),
and then catch that when deleting an object using eval() or Try::Tiny (which I
think is a prereq of DBIC anyway).

Mind you, off the top of my head, I'm not sure what exceptions DBIC throws if a
delete fails or if the object was never there to begin with...

::: Koha/Objects.pm
@@ +187,5 @@
> +
> +sub _wrap {
> +    my ( $self, @dbic_rows ) = @_;
> +
> +    my @objects = map { $self->object_class()->new_from_dbic( $_ ) } @dbic_rows;

Mmm, I see... so you use Koha::Objects for fetching objects from the
database... and it wraps the resultset with the applicable object based on
Koha::Object...

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list