public function __invoke(Account $account) { $accountId = $account->getId(); $accountEmail = $account->getEmail(); $this->accountRepository->deleteAccount($account); return ['id' => $accountId, 'email' => $accountEmail, 'entity' => $account]; }
public function deleteAccount(int $accountId) : Account { $account = $this->getById($accountId); $this->accountRepository->deleteAccount($account); return $account; }