mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Code for #3546
This commit is contained in:
@@ -171,4 +171,18 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
|
||||
{
|
||||
return $objectGroup->piggyBanks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function deleteAll(): void
|
||||
{
|
||||
$all = $this->get();
|
||||
/** @var ObjectGroup $group */
|
||||
foreach ($all as $group) {
|
||||
$group->piggyBanks()->sync([]);
|
||||
$group->bills()->sync([]);
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ interface ObjectGroupRepositoryInterface
|
||||
* Delete empty ones.
|
||||
*/
|
||||
public function deleteEmpty(): void;
|
||||
/**
|
||||
* Delete all.
|
||||
*/
|
||||
public function deleteAll(): void;
|
||||
|
||||
/**
|
||||
* @param ObjectGroup $objectGroup
|
||||
|
||||
Reference in New Issue
Block a user