This commit is contained in:
James Cole
2025-02-05 06:36:51 +01:00
parent eca12f661f
commit 90bfdc7573
8 changed files with 44 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Observer;
use FireflyIII\Models\Recurrence;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
/**
* Class RecurrenceObserver
@@ -33,8 +34,12 @@ class RecurrenceObserver
public function deleting(Recurrence $recurrence): void
{
app('log')->debug('Observe "deleting" of a recurrence.');
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($recurrence->user);
foreach ($recurrence->attachments()->get() as $attachment) {
$attachment->delete();
$repository->destroy($attachment);
}
$recurrence->recurrenceRepetitions()->delete();