entityManager = $entityManager; $this->passwordService = $passwordService; } /** * @throws SendingError * @throws Error */ public function run(Data $data): void { $userId = $data->getTargetId(); if (!$userId) { throw new Error(); } /** @var ?User $user */ $user = $this->entityManager->getEntityById(User::ENTITY_TYPE, $userId); if (!$user) { throw new Error("User '{$userId}' not found."); } $this->passwordService->sendAccessInfoForNewUser($user); } }