PropertyIdGeneratedTrait::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/sharep.
7
 *
8
 * (c) Zbigniew Ślązak
9
 */
10
11
namespace App\Entity\Traits;
12
13
use ApiPlatform\Core\Annotation as OA;
14
use Doctrine\ORM\Mapping as ORM;
15
use Symfony\Component\Serializer\Annotation as Serializer;
16
use Symfony\Component\Validator\Constraints as Assert;
17
18
trait PropertyIdGeneratedTrait
19
{
20
    /**
21
     * @var string|null
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="NONE")
24
     * @ORM\Column(name="id", type="string", length=22)
25
     *
26
     * @Assert\Type(type="string")
27
     * @Assert\NotBlank()
28
     *
29
     * @Serializer\Groups({"get"})
30
     * @OA\ApiProperty(identifier=true)
31
     * @OA\ApiFilter(
32
     *     ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class,
33
     *     strategy="exact"
34
     * )
35
     */
36
    private $id;
37
38 13
    public function getId(): string
39
    {
40 13
        return $this->id;
41
    }
42
}
43