+sub save {
+ my ($self, @args) = @_;
+
+ my $result;
+ my $worker = sub {
+ SL::DB::Object::Hooks::run_hooks($self, 'before_save');
+ $result = $self->SUPER::save(@args);
+ SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result);
+ };
+
+ $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
+ return $result;
+}
+
+sub delete {
+ my ($self, @args) = @_;
+
+ my $result;
+ my $worker = sub {
+ SL::DB::Object::Hooks::run_hooks($self, 'before_delete');
+ $result = $self->SUPER::delete(@args);
+ SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result);
+ };
+
+ $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
+ return $result;