Passed
Push — master ( 77290b...f3fb78 )
by Marcel
09:09
created

ActiveSessionsDoctrineSchemaSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A postGenerateSchema() 0 2 1
A getSubscribedEvents() 0 3 1
A __construct() 0 1 1
1
<?php
2
3
namespace App\Security\Session;
4
5
use Doctrine\Common\EventSubscriber;
6
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
7
use Doctrine\ORM\Tools\ToolEvents;
8
9
/**
10
 * Extends the database schema to allow storing user
11
 */
12
class ActiveSessionsDoctrineSchemaSubscriber implements EventSubscriber {
13
14
    public function __construct(private readonly ActiveSessionsResolver $sessionsResolver) {
15
16
    }
17
18
    public function postGenerateSchema(GenerateSchemaEventArgs $event): void {
19
        $this->sessionsResolver->configureSchema($event->getSchema(), $event->getEntityManager()->getConnection());
20
    }
21
22
    public function getSubscribedEvents(): array {
23
        return [
24
            ToolEvents::postGenerateSchema
25
        ];
26
    }
27
}