Test Failed
Push — master ( 295a46...80e8d3 )
by Daniel
05:57
created

IdTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 14
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[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
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\Entity\Utility;
15
16
use ApiPlatform\Core\Annotation\ApiProperty;
17
use Doctrine\ORM\Mapping as ORM;
18
use Ramsey\Uuid\Doctrine\UuidGenerator;
19
use Ramsey\Uuid\UuidInterface;
20
21
/**
22
 * Reusable trait by application developer so keep annotations as we cannot map with XML.
23
 *
24
 * @author Daniel West <[email protected]>
25
 */
26
trait IdTrait
27
{
28
    /**
29
     * @ORM\Id
30
     * @ORM\Column(type="uuid", unique=true)
31
     * @ORM\GeneratedValue(strategy="CUSTOM")
32
     * @ORM\CustomIdGenerator(class=UuidGenerator::class)
33 74
     * @ApiProperty(readable=false)
34
     */
35 74
    private UuidInterface $id;
36 74
37
    public function getId(): UuidInterface
38
    {
39
        return $this->id;
40
    }
41
}
42