* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ namespace PrestaShop\Module\PsAccounts\Hook; use PrestaShop\Module\PsAccounts\Repository\EmployeeAccountRepository; class ActionObjectEmployeeDeleteAfter extends Hook { /** * @param array $params * * @return void * * @throws \Exception */ public function execute(array $params = []) { /** @var \Employee $employee */ $employee = $params['object']; $repository = new EmployeeAccountRepository(); try { $employeeAccount = $repository->findByEmployeeId($employee->id); $repository->delete($employeeAccount); } catch (\Exception $e) { } } }