API endpoints to delete customer/project/activity (#5181)

* added service methods with events to delete customer, project, activity
* added API endpoints to delete customer, project, activity
* added tests for new API endpoints
This commit is contained in:
Kevin Papst
2024-11-27 15:25:13 +01:00
committed by GitHub
parent f13b81ede7
commit e030ff08db
13 changed files with 408 additions and 80 deletions

View File

@@ -14,6 +14,7 @@ use App\Entity\Customer;
use App\Event\CustomerCreateEvent;
use App\Event\CustomerCreatePostEvent;
use App\Event\CustomerCreatePreEvent;
use App\Event\CustomerDeleteEvent;
use App\Event\CustomerMetaDefinitionEvent;
use App\Event\CustomerUpdatePostEvent;
use App\Event\CustomerUpdatePreEvent;
@@ -73,6 +74,12 @@ final class CustomerService
return $customer;
}
public function deleteCustomer(Customer $customer): void
{
$this->dispatcher->dispatch(new CustomerDeleteEvent($customer));
$this->repository->deleteCustomer($customer);
}
/**
* @param string[] $groups
* @throws ValidationFailedException