Passed
Push — master ( df4d16...ea7d0c )
by Marcel
06:58
created

DocumentCategory::getDocuments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
ccs 0
cts 0
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Entity;
4
5
use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\ORM\Mapping as ORM;
9
use Ramsey\Uuid\Uuid;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
#[Auditable]
13
#[ORM\Entity]
14
class DocumentCategory {
15
16
    use IdTrait;
17
    use UuidTrait;
18
19
    #[Assert\NotBlank]
20
    #[Assert\NotNull]
21
    #[ORM\Column(type: 'string')]
22
    private ?string $name = null;
23
24
    #[ORM\Column(type: 'string', nullable: true)]
25
    #[Assert\NotBlank(allowNull: true)]
26
    private ?string $icon = null;
27
28
    /**
29
     * @var ArrayCollection<Document>
30
     */
31
    #[ORM\OneToMany(mappedBy: 'category', targetEntity: Document::class)]
32
    private $documents;
33
34
    public function __construct() {
35 3
        $this->uuid = Uuid::uuid4();
36 3
        $this->documents = new ArrayCollection();
37 3
    }
38 3
39
    /**
40
     * @return string
41
     */
42
    public function getName(): ?string {
43 1
        return $this->name;
44 1
    }
45
46
    public function setName(?string $name): DocumentCategory {
47
        $this->name = $name;
48
        return $this;
49
    }
50
51 2
    /**
52 2
     * @return string|null
53 2
     */
54
    public function getIcon(): ?string {
55
        return $this->icon;
56
    }
57
58
    /**
59 1
     * @param string|null $icon
60 1
     * @return DocumentCategory
61
     */
62
    public function setIcon(?string $icon): DocumentCategory {
63
        $this->icon = $icon;
64
        return $this;
65
    }
66
67
    /**
68
     * @return Collection<Document>
69
     */
70
    public function getDocuments(): Collection {
71
        return $this->documents;
72
    }
73
74
}