diff options
Diffstat (limited to 'Bugzilla/Object.pm')
-rw-r--r-- | Bugzilla/Object.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index cde440b95..532b2c5bc 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -290,6 +290,15 @@ sub update { return \%changes; } +sub remove_from_db { + my $self = shift; + my $table = $self->DB_TABLE; + my $id_field = $self->ID_FIELD; + Bugzilla->dbh->do("DELETE FROM $table WHERE $id_field = ?", + undef, $self->id); + undef $self; +} + ############################### #### Subroutines ###### ############################### @@ -726,6 +735,12 @@ C<update>.) =back +=item C<remove_from_db> + +Removes this object from the database. Will throw an error if you can't +remove it for some reason. The object will then be destroyed, as it is +not safe to use the object after it has been removed from the database. + =back =head2 Subclass Helpers |