Completed
Push — master ( c2c405...3e6d59 )
by Luis Ramón
02:18
created

Version::getFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
  ÁTICA - Aplicación web para la gestión documental de centros educativos
4
5
  Copyright (C) 2015-2017: Luis Ramón López López
6
7
  This program is free software: you can redistribute it and/or modify
8
  it under the terms of the GNU Affero General Public License as published by
9
  the Free Software Foundation, either version 3 of the License, or
10
  (at your option) any later version.
11
12
  This program is distributed in the hope that it will be useful,
13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
  GNU Affero General Public License for more details.
16
17
  You should have received a copy of the GNU Affero General Public License
18
  along with this program.  If not, see [http://www.gnu.org/licenses/].
19
*/
20
21
namespace AppBundle\Entity\Documentation;
22
23
use AppBundle\Entity\Traits\UserBlameableTrait;
24
use Gedmo\Mapping\Annotation as Gedmo;
25
use Doctrine\ORM\Mapping as ORM;
26
use Gedmo\Timestampable\Traits\TimestampableEntity;
27
28
/**
29
 * @ORM\Entity(repositoryClass="VersionRepository")
30
 * @ORM\Table(name="documentation_version")
31
 */
32
class Version
33
{
34
    const STATUS_DRAFT = 0;
35
    const STATUS_REVIEWED = 1;
36
    const STATUS_APPROVED = 2;
37
    const STATUS_DEPRECATED = 3;
38
    const STATUS_LOCKED = 4;
39
    const STATUS_DISCARDED = 5;
40
41
    use TimestampableEntity;
42
    use UserBlameableTrait;
43
44
    /**
45
     * @ORM\Id()
46
     * @ORM\GeneratedValue(strategy="AUTO")
47
     * @ORM\Column(type="integer")
48
     * @var int
49
     */
50
    private $id;
51
52
    /**
53
     * @ORM\Column(type="text", nullable=true)
54
     * @var string
55
     */
56
    private $description;
57
58
    /**
59
     * @ORM\Column(type="integer")
60
     * @var int
61
     */
62
    private $state;
63
64
    /**
65
     * @Gedmo\Timestampable(on="change", field="state")
66
     * @ORM\Column(type="datetime")
67
     * @var \DateTime
68
     */
69
    private $stateChangedAt;
70
71
    /**
72
     * @ORM\Column(type="integer")
73
     * @var int
74
     */
75
    private $versionNr;
76
77
    /**
78
     * @ORM\ManyToOne(targetEntity="Entry", inversedBy="versions")
79
     * @ORM\JoinColumn(nullable=false)
80
     * @var Entry
81
     */
82
    private $entry;
83
84
    /**
85
     * @ORM\Column(type="string", nullable=true)
86
     * @var string
87
     */
88
    private $file;
89
90
    /**
91
     * @ORM\Column(type="string", nullable=true)
92
     * @var string
93
     */
94
    private $fileMimeType;
95
96
    /**
97
     * @ORM\Column(type="string", nullable=true)
98
     * @var string
99
     */
100
    private $fileExtension;
101
102
    public function __construct()
103
    {
104
        $this->state = $this::STATUS_DRAFT;
105
        $this->stateChangedAt = new \DateTime();
106
    }
107
108
    /**
109
     * Get id
110
     *
111
     * @return integer
112
     */
113
    public function getId()
114
    {
115
        return $this->id;
116
    }
117
118
    /**
119
     * Set description
120
     *
121
     * @param string $description
122
     *
123
     * @return Version
124
     */
125
    public function setDescription($description)
126
    {
127
        $this->description = $description;
128
129
        return $this;
130
    }
131
132
    /**
133
     * Get description
134
     *
135
     * @return string
136
     */
137
    public function getDescription()
138
    {
139
        return $this->description;
140
    }
141
142
    /**
143
     * Set state
144
     *
145
     * @param integer $state
146
     *
147
     * @return Version
148
     */
149
    public function setState($state)
150
    {
151
        $this->state = $state;
152
153
        return $this;
154
    }
155
156
    /**
157
     * Get state
158
     *
159
     * @return integer
160
     */
161
    public function getState()
162
    {
163
        return $this->state;
164
    }
165
166
    /**
167
     * Set stateChangedAt
168
     *
169
     * @param \DateTime $stateChangedAt
170
     *
171
     * @return Version
172
     */
173
    public function setStateChangedAt($stateChangedAt)
174
    {
175
        $this->stateChangedAt = $stateChangedAt;
176
177
        return $this;
178
    }
179
180
    /**
181
     * Get stateChangedAt
182
     *
183
     * @return \DateTime
184
     */
185
    public function getStateChangedAt()
186
    {
187
        return $this->stateChangedAt;
188
    }
189
190
    /**
191
     * Set versionNr
192
     *
193
     * @param integer $versionNr
194
     *
195
     * @return Version
196
     */
197
    public function setVersionNr($versionNr)
198
    {
199
        $this->versionNr = $versionNr;
200
201
        return $this;
202
    }
203
204
    /**
205
     * Get versionNr
206
     *
207
     * @return integer
208
     */
209
    public function getVersionNr()
210
    {
211
        return $this->versionNr;
212
    }
213
214
    /**
215
     * Set entry
216
     *
217
     * @param Entry $entry
218
     *
219
     * @return Version
220
     */
221
    public function setEntry(Entry $entry)
222
    {
223
        $this->entry = $entry;
224
225
        return $this;
226
    }
227
228
    /**
229
     * Get entry
230
     *
231
     * @return Entry
232
     */
233
    public function getEntry()
234
    {
235
        return $this->entry;
236
    }
237
238
    /**
239
     * @return string
240
     */
241
    public function getFile()
242
    {
243
        return $this->file;
244
    }
245
246
    /**
247
     * @param string $file
248
     *
249
     * @return Version
250
     */
251
    public function setFile($file)
252
    {
253
        $this->file = $file;
254
        return $this;
255
    }
256
257
    /**
258
     * @return string
259
     */
260
    public function getFileMimeType()
261
    {
262
        return $this->fileMimeType;
263
    }
264
265
    /**
266
     * @param string $fileMimeType
267
     * @return Version
268
     *
269
     */
270
    public function setFileMimeType($fileMimeType)
271
    {
272
        $this->fileMimeType = $fileMimeType;
273
        return $this;
274
    }
275
276
    /**
277
     * @return string
278
     */
279
    public function getFileExtension()
280
    {
281
        return $this->fileExtension;
282
    }
283
284
    /**
285
     * @param string $fileExtension
286
     *
287
     * @return Version
288
     */
289
    public function setFileExtension($fileExtension)
290
    {
291
        $this->fileExtension = $fileExtension;
292
        return $this;
293
    }
294
}
295