Failed Conditions
Push — master ( ddb3cd...4476ec )
by Marco
11:47
created

UuidGenerator::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Sequencing;
6
7
use Doctrine\ORM\EntityManagerInterface;
8
9
/**
10
 * Represents an ID generator that uses the database UUID expression
11
 */
12
class UuidGenerator implements Generator
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function generate(EntityManagerInterface $em, $entity)
18
    {
19
        $conn = $em->getConnection();
20
        $sql  = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
21
22
        return $conn->query($sql)->fetchColumn(0);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function isPostInsertGenerator()
29
    {
30
        return false;
31
    }
32
}
33