Completed
Push — ezp-30725-3.0 ( 60d54b )
by
unknown
44:30 queued 27:12
created

DeleteUserSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace eZ\Publish\Core\Repository\EventSubscriber;
4
5
use eZ\Publish\API\Repository\ContentTypeService;
6
use eZ\Publish\API\Repository\Events\User\DeleteUserEvent;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
9
class DeleteUserSubscriber implements EventSubscriberInterface
10
{
11
    /** @var \eZ\Publish\API\Repository\ContentTypeService */
12
    private $contentTypeService;
13
14
    public function __construct(ContentTypeService $contentTypeService)
15
    {
16
        $this->contentTypeService = $contentTypeService;
17
    }
18
19
    public static function getSubscribedEvents(): array
20
    {
21
        return [
22
            DeleteUserEvent::class => 'onDeleteUser',
23
        ];
24
    }
25
26
    public function onDeleteUser(DeleteUserEvent $event): void
27
    {
28
        $this->contentTypeService->deleteUserDrafts($event->getUser()->id);
29
    }
30
}