CCalendarEventAttachment   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 11
eloc 28
dl 0
loc 78
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A setResourceName() 0 3 1
A getResourceName() 0 3 1
A getResourceIdentifier() 0 3 1
A __toString() 0 3 1
A setComment() 0 5 1
A setEvent() 0 5 1
A getEvent() 0 3 1
A getComment() 0 3 1
A getIid() 0 3 1
A setFilename() 0 5 1
A getFilename() 0 3 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CourseBundle\Entity;
8
9
use Chamilo\CoreBundle\Entity\AbstractResource;
10
use Chamilo\CoreBundle\Entity\ResourceInterface;
11
use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository;
12
use Doctrine\ORM\Mapping as ORM;
13
use Stringable;
14
use Symfony\Component\Uid\Uuid;
15
16
/**
17
 * CCalendarEventAttachment.
18
 */
19
#[ORM\Table(name: 'c_calendar_event_attachment')]
20
#[ORM\Entity(repositoryClass: CCalendarEventAttachmentRepository::class)]
21
class CCalendarEventAttachment extends AbstractResource implements ResourceInterface, Stringable
22
{
23
    #[ORM\Column(name: 'iid', type: 'integer')]
24
    #[ORM\Id]
25
    #[ORM\GeneratedValue]
26
    protected ?int $iid = null;
27
28
    #[ORM\Column(name: 'comment', type: 'text', nullable: true)]
29
    protected ?string $comment = null;
30
31
    #[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)]
32
    protected string $filename;
33
34
    #[ORM\ManyToOne(targetEntity: CCalendarEvent::class, cascade: ['persist'], inversedBy: 'attachments')]
35
    #[ORM\JoinColumn(name: 'agenda_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
36
    protected CCalendarEvent $event;
37
38
    public function __toString(): string
39
    {
40
        return $this->getFilename();
41
    }
42
43
    public function setComment(string $comment): self
44
    {
45
        $this->comment = $comment;
46
47
        return $this;
48
    }
49
50
    public function getComment(): ?string
51
    {
52
        return $this->comment;
53
    }
54
55
    public function setFilename(string $filename): self
56
    {
57
        $this->filename = $filename;
58
59
        return $this;
60
    }
61
62
    public function getFilename(): string
63
    {
64
        return $this->filename;
65
    }
66
67
    public function getIid(): ?int
68
    {
69
        return $this->iid;
70
    }
71
72
    public function getEvent(): CCalendarEvent
73
    {
74
        return $this->event;
75
    }
76
77
    public function setEvent(CCalendarEvent $event): self
78
    {
79
        $this->event = $event;
80
81
        return $this;
82
    }
83
84
    public function getResourceIdentifier(): int|Uuid
85
    {
86
        return $this->getIid();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getIid() could return the type null which is incompatible with the type-hinted return Symfony\Component\Uid\Uuid|integer. Consider adding an additional type-check to rule them out.
Loading history...
87
    }
88
89
    public function getResourceName(): string
90
    {
91
        return $this->getFilename();
92
    }
93
94
    public function setResourceName(string $name): self
95
    {
96
        return $this->setFilename($name);
97
    }
98
}
99