AbstractListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createDateTimeField() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\Doctrine\EventListener\ORM;
13
14
use Doctrine\Common\EventSubscriber;
15
use Doctrine\ORM\Mapping\ClassMetadata;
16
17
abstract class AbstractListener implements EventSubscriber
18
{
19
    final protected function createDateTimeField(ClassMetadata $metadata, string $field, bool $nullable): void
20
    {
21
        if ($metadata->hasField($field)) {
22
            return;
23
        }
24
25
        $metadata->mapField([
26
            'type'      => 'datetime',
27
            'fieldName' => $field,
28
            'nullable'  => $nullable,
29
        ]);
30
    }
31
}
32