Passed
Push — master ( 2cb959...2b5b03 )
by Julito
11:13 queued 10s
created

AttemptFile   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 19
dl 0
loc 73
rs 10
c 1
b 0
f 1
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setComment() 0 5 1
A getAsset() 0 3 1
A getAttempt() 0 3 1
A setAttempt() 0 5 1
A setAsset() 0 5 1
A __construct() 0 4 1
A getComment() 0 3 1
A getId() 0 3 1
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
/**
15
 * @ORM\Table(
16
 *     name="attempt_file",
17
 * )
18
 * @ORM\Entity
19
 */
20
class AttemptFile
21
{
22
    use TimestampableEntity;
23
24
    /**
25
     * @ORM\Id
26
     * @ORM\Column(type="uuid")
27
     */
28
    protected Uuid $id;
29
30
    /**
31
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt", inversedBy="files")
32
     * @ORM\JoinColumn(name="attempt_id", referencedColumnName="id", onDelete="CASCADE")
33
     */
34
    #[Assert\NotNull]
35
    protected TrackEAttempt $attempt;
36
37
    /**
38
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"remove"} )
39
     * @ORM\JoinColumn(name="asset_id", referencedColumnName="id", onDelete="CASCADE")
40
     */
41
    protected ?Asset $asset;
42
43
    /**
44
     * @ORM\Column(name="comment", type="text", nullable=false)
45
     */
46
    protected string $comment;
47
48
    public function __construct()
49
    {
50
        $this->id = Uuid::v4();
51
        $this->comment = '';
52
    }
53
54
    public function getId(): Uuid
55
    {
56
        return $this->id;
57
    }
58
59
    public function getAttempt(): TrackEAttempt
60
    {
61
        return $this->attempt;
62
    }
63
64
    public function setAttempt(TrackEAttempt $attempt): self
65
    {
66
        $this->attempt = $attempt;
67
68
        return $this;
69
    }
70
71
    public function getAsset(): ?Asset
72
    {
73
        return $this->asset;
74
    }
75
76
    public function setAsset(?Asset $asset): self
77
    {
78
        $this->asset = $asset;
79
80
        return $this;
81
    }
82
83
    public function getComment(): string
84
    {
85
        return $this->comment;
86
    }
87
88
    public function setComment(string $comment): self
89
    {
90
        $this->comment = $comment;
91
92
        return $this;
93
    }
94
}
95