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
![]() |
|||
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 |