vendor/ibexa/core/src/lib/Repository/EventSubscriber/DeleteUserSubscriber.php line 32

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace Ibexa\Core\Repository\EventSubscriber;
  8. use Ibexa\Contracts\Core\Repository\ContentTypeService;
  9. use Ibexa\Contracts\Core\Repository\Events\User\DeleteUserEvent;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. class DeleteUserSubscriber implements EventSubscriberInterface
  12. {
  13.     /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
  14.     private $contentTypeService;
  15.     public function __construct(ContentTypeService $contentTypeService)
  16.     {
  17.         $this->contentTypeService $contentTypeService;
  18.     }
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             DeleteUserEvent::class => 'onDeleteUser',
  23.         ];
  24.     }
  25.     public function onDeleteUser(DeleteUserEvent $event): void
  26.     {
  27.         $this->contentTypeService->deleteUserDrafts($event->getUser()->id);
  28.     }
  29. }
  30. class_alias(DeleteUserSubscriber::class, 'eZ\Publish\Core\Repository\EventSubscriber\DeleteUserSubscriber');