FacilitatorDocument::getFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Model;
6
7
use Application\Repository\FacilitatorDocumentRepository;
8
use Doctrine\ORM\Mapping as ORM;
9
use Ecodev\Felix\Model\Traits\HasName;
10
11
/**
12
 * An item that can be booked by a user.
13
 */
14
#[ORM\Entity(FacilitatorDocumentRepository::class)]
15
class FacilitatorDocument extends AbstractModel
16
{
17
    use HasName;
18
19
    #[ORM\OneToOne(targetEntity: File::class, orphanRemoval: true)]
20
    #[ORM\JoinColumn(onDelete: 'SET NULL')]
21
    private ?File $file = null;
22
23
    #[ORM\Column(type: 'string', length: 191)]
24
    private string $category = '';
25
26
    public function getFile(): ?File
27
    {
28
        return $this->file;
29
    }
30
31
    public function setFile(?File $file): void
32
    {
33
        // We must trigger lazy loading, otherwise Doctrine will seriously
34
        // mess up lifecycle callbacks and delete unrelated image on disk
35
        if ($this->file) {
36
            $this->file->getFilename();
37
        }
38
39
        $this->file = $file;
40
    }
41
42
    /**
43
     * Set category.
44
     */
45
    public function setCategory(string $category): void
46
    {
47
        $this->category = $category;
48
    }
49
50
    /**
51
     * Get category.
52
     */
53
    public function getCategory(): string
54
    {
55
        return $this->category;
56
    }
57
}
58