Passed
Push — master ( fc8817...f91339 )
by Angel Fernando Quiroz
10:10 queued 10s
created

H5pImport   A

Complexity

Total Complexity 24

Size/Duplication

Total Lines 232
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 47
dl 0
loc 232
rs 10
c 0
b 0
f 0
wmc 24

24 Methods

Rating   Name   Duplication   Size   Complexity  
A setPath() 0 5 1
A getMainLibrary() 0 3 1
A addLibraries() 0 6 1
A setSession() 0 5 1
A getPath() 0 3 1
A getSession() 0 3 1
A getRelativePath() 0 3 1
A setDescription() 0 5 1
A __construct() 0 3 1
A getDescription() 0 3 1
A setIid() 0 3 1
A removeLibraries() 0 5 1
A setCourse() 0 5 1
A setModifiedAt() 0 3 1
A setMainLibrary() 0 5 1
A getName() 0 3 1
A getModifiedAt() 0 3 1
A setCreatedAt() 0 5 1
A setRelativePath() 0 5 1
A getCourse() 0 3 1
A getIid() 0 3 1
A getCreatedAt() 0 3 1
A getLibraries() 0 3 1
A setName() 0 5 1
1
<?php
2
3
// For licensing terms, see /license.txt
4
5
namespace Chamilo\PluginBundle\H5pImport\Entity;
6
7
use Chamilo\CoreBundle\Entity\Course;
8
use Chamilo\CoreBundle\Entity\Session;
9
use DateTime;
10
use Doctrine\Common\Collections\ArrayCollection;
11
use Doctrine\Common\Collections\Collection;
12
use Doctrine\ORM\Mapping as ORM;
13
use Gedmo\Mapping\Annotation as Gedmo;
14
15
/**
16
 * Class H5pImport.
17
 *
18
 * @ORM\Entity()
19
 *
20
 * @ORM\Table(name="plugin_h5p_import")
21
 */
22
class H5pImport
23
{
24
    /**
25
     * @var string
26
     *
27
     * @ORM\Column(name="path", type="text", nullable=false)
28
     */
29
    protected $path;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(name="relative_path", type="text", nullable=false)
35
     */
36
    protected $relativePath;
37
38
    /**
39
     * @var DateTime
40
     *
41
     * @Gedmo\Timestampable(on="create")
42
     *
43
     * @ORM\Column(name="created_at", type="datetime", nullable=false)
44
     */
45
    protected $createdAt;
46
47
    /**
48
     * @var DateTime
49
     *
50
     * @Gedmo\Timestampable(on="update")
51
     *
52
     * @ORM\Column(name="modified_at", type="datetime", nullable=false)
53
     */
54
    protected $modifiedAt;
55
56
    /**
57
     * @var int
58
     *
59
     * @ORM\Column(name="iid", type="integer")
60
     *
61
     * @ORM\Id
62
     *
63
     * @ORM\GeneratedValue
64
     */
65
    private $iid;
66
67
    /**
68
     * @var Course
69
     *
70
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course")
71
     *
72
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id", nullable=false)
73
     */
74
    private $course;
75
76
    /**
77
     * @var null|Session
78
     *
79
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session")
80
     *
81
     * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
82
     */
83
    private $session;
84
85
    /**
86
     * @var null|string
87
     *
88
     * @ORM\Column(name="name", type="text", nullable=true)
89
     */
90
    private $name;
91
92
    /**
93
     * @var null|string
94
     *
95
     * @ORM\Column(name="description", type="text", nullable=true)
96
     */
97
    private $description;
98
99
    /**
100
     * @var Collection<int, H5pImportLibrary>
101
     *
102
     * @ORM\ManyToMany(targetEntity="H5pImportLibrary", mappedBy="h5pImports", cascade={"persist"})
103
     */
104
    private $libraries;
105
106
    /**
107
     * @var H5pImportLibrary
108
     *
109
     * @ORM\ManyToOne(targetEntity="H5pImportLibrary")
110
     *
111
     * @ORM\JoinColumn(name="main_library_id", referencedColumnName="iid", onDelete="SET NULL")
112
     */
113
    private $mainLibrary;
114
115
    public function __construct()
116
    {
117
        $this->libraries = new ArrayCollection();
118
    }
119
120
    public function getIid(): int
121
    {
122
        return $this->iid;
123
    }
124
125
    public function setIid(int $iid): void
126
    {
127
        $this->iid = $iid;
128
    }
129
130
    public function getCourse(): Course
131
    {
132
        return $this->course;
133
    }
134
135
    public function setCourse(Course $course): H5pImport
136
    {
137
        $this->course = $course;
138
139
        return $this;
140
    }
141
142
    public function getSession(): ?Session
143
    {
144
        return $this->session;
145
    }
146
147
    public function setSession(?Session $session): H5pImport
148
    {
149
        $this->session = $session;
150
151
        return $this;
152
    }
153
154
    public function getName(): string
155
    {
156
        return $this->name;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->name could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
157
    }
158
159
    public function setName(string $name): H5pImport
160
    {
161
        $this->name = $name;
162
163
        return $this;
164
    }
165
166
    public function getPath(): string
167
    {
168
        return $this->path;
169
    }
170
171
    public function setPath(string $path): H5pImport
172
    {
173
        $this->path = $path;
174
175
        return $this;
176
    }
177
178
    public function getDescription(): ?string
179
    {
180
        return $this->description;
181
    }
182
183
    public function setDescription(?string $description): H5pImport
184
    {
185
        $this->description = $description;
186
187
        return $this;
188
    }
189
190
    public function getRelativePath(): string
191
    {
192
        return $this->relativePath;
193
    }
194
195
    public function setRelativePath(string $relativePath): H5pImport
196
    {
197
        $this->relativePath = $relativePath;
198
199
        return $this;
200
    }
201
202
    public function getCreatedAt(): DateTime
203
    {
204
        return $this->createdAt;
205
    }
206
207
    public function setCreatedAt(DateTime $createdAt): H5pImport
208
    {
209
        $this->createdAt = $createdAt;
210
211
        return $this;
212
    }
213
214
    public function getModifiedAt(): DateTime
215
    {
216
        return $this->modifiedAt;
217
    }
218
219
    public function setModifiedAt(DateTime $modifiedAt): void
220
    {
221
        $this->modifiedAt = $modifiedAt;
222
    }
223
224
    public function addLibraries(H5pImportLibrary $library): self
225
    {
226
        $library->addH5pImport($this);
227
        $this->libraries[] = $library;
228
229
        return $this;
230
    }
231
232
    public function removeLibraries(H5pImportLibrary $library): self
233
    {
234
        $this->libraries->removeElement($library);
235
236
        return $this;
237
    }
238
239
    public function getLibraries(): Collection
240
    {
241
        return $this->libraries;
242
    }
243
244
    public function setMainLibrary(H5pImportLibrary $library): self
245
    {
246
        $this->mainLibrary = $library;
247
248
        return $this;
249
    }
250
251
    public function getMainLibrary(): ?H5pImportLibrary
252
    {
253
        return $this->mainLibrary;
254
    }
255
}
256