Passed
Push — master ( c7d7ec...eff4fb )
by Sam
15:35
created

FacilitatorDocument::setCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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