Completed
Push — master ( 4e608a...fcc2ac )
by
unknown
02:01 queued 37s
created

AttemptFeedback::getAsset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Doctrine\ORM\Mapping as ORM;
10
use Gedmo\Timestampable\Traits\TimestampableEntity;
11
use Symfony\Component\Uid\Uuid;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
#[ORM\Table(name: 'attempt_feedback')]
15
#[ORM\Entity]
16
class AttemptFeedback
17
{
18
    use TimestampableEntity;
19
20
    #[ORM\Id]
21
    #[ORM\Column(type: 'uuid')]
22
    protected Uuid $id;
23
24
    #[Assert\NotNull]
25
    #[ORM\ManyToOne(targetEntity: TrackEAttempt::class, inversedBy: 'attemptFeedbacks')]
26
    #[ORM\JoinColumn(name: 'attempt_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
27
    protected TrackEAttempt $attempt;
28
29
    #[Assert\NotNull]
30
    #[ORM\ManyToOne(targetEntity: User::class)]
31
    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
32
    protected User $user;
33
34
    #[ORM\ManyToOne(targetEntity: ResourceNode::class)]
35
    protected ?ResourceNode $resourceNode = null;
36
37
    #[ORM\Column(name: 'comment', type: 'text', nullable: false)]
38
    protected string $comment;
39
40
    public function __construct()
41
    {
42
        $this->id = Uuid::v4();
43
        $this->comment = '';
44
    }
45
46
    public function getId(): Uuid
47
    {
48
        return $this->id;
49
    }
50
51
    public function getAttempt(): TrackEAttempt
52
    {
53
        return $this->attempt;
54
    }
55
56
    public function setAttempt(TrackEAttempt $attempt): self
57
    {
58
        $this->attempt = $attempt;
59
60
        return $this;
61
    }
62
63
    public function getUser(): User
64
    {
65
        return $this->user;
66
    }
67
68
    public function setUser(User $user): self
69
    {
70
        $this->user = $user;
71
72
        return $this;
73
    }
74
75
    public function getResourceNode(): ?ResourceNode
76
    {
77
        return $this->resourceNode;
78
    }
79
80
    public function setResourceNode(?ResourceNode $resourceNode): self
81
    {
82
        $this->resourceNode = $resourceNode;
83
84
        return $this;
85
    }
86
87
    public function clearResourceNode(): self
88
    {
89
        // Detach the resource node reference when feedback file is removed.
90
        $this->resourceNode = null;
91
92
        return $this;
93
    }
94
95
    public function getComment(): string
96
    {
97
        return $this->comment;
98
    }
99
100
    public function setComment(string $comment): self
101
    {
102
        $this->comment = $comment;
103
104
        return $this;
105
    }
106
}
107