Completed
Push — master ( 2ae089...5f42d6 )
by Luis Ramón
13:38
created

Version::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
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
    public function __construct()
91
    {
92
        $this->state = $this::STATUS_DRAFT;
93
        $this->stateChangedAt = new \DateTime();
94
    }
95
96
    /**
97
     * Get id
98
     *
99
     * @return integer
100
     */
101
    public function getId()
102
    {
103
        return $this->id;
104
    }
105
106
    /**
107
     * Set description
108
     *
109
     * @param string $description
110
     *
111
     * @return Version
112
     */
113
    public function setDescription($description)
114
    {
115
        $this->description = $description;
116
117
        return $this;
118
    }
119
120
    /**
121
     * Get description
122
     *
123
     * @return string
124
     */
125
    public function getDescription()
126
    {
127
        return $this->description;
128
    }
129
130
    /**
131
     * Set state
132
     *
133
     * @param integer $state
134
     *
135
     * @return Version
136
     */
137
    public function setState($state)
138
    {
139
        $this->state = $state;
140
141
        return $this;
142
    }
143
144
    /**
145
     * Get state
146
     *
147
     * @return integer
148
     */
149
    public function getState()
150
    {
151
        return $this->state;
152
    }
153
154
    /**
155
     * Set stateChangedAt
156
     *
157
     * @param \DateTime $stateChangedAt
158
     *
159
     * @return Version
160
     */
161
    public function setStateChangedAt($stateChangedAt)
162
    {
163
        $this->stateChangedAt = $stateChangedAt;
164
165
        return $this;
166
    }
167
168
    /**
169
     * Get stateChangedAt
170
     *
171
     * @return \DateTime
172
     */
173
    public function getStateChangedAt()
174
    {
175
        return $this->stateChangedAt;
176
    }
177
178
    /**
179
     * Set versionNr
180
     *
181
     * @param integer $versionNr
182
     *
183
     * @return Version
184
     */
185
    public function setVersionNr($versionNr)
186
    {
187
        $this->versionNr = $versionNr;
188
189
        return $this;
190
    }
191
192
    /**
193
     * Get versionNr
194
     *
195
     * @return integer
196
     */
197
    public function getVersionNr()
198
    {
199
        return $this->versionNr;
200
    }
201
202
    /**
203
     * Set entry
204
     *
205
     * @param Entry $entry
206
     *
207
     * @return Version
208
     */
209
    public function setEntry(Entry $entry)
210
    {
211
        $this->entry = $entry;
212
213
        return $this;
214
    }
215
216
    /**
217
     * Get entry
218
     *
219
     * @return Entry
220
     */
221
    public function getEntry()
222
    {
223
        return $this->entry;
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getFile()
230
    {
231
        return $this->file;
232
    }
233
234
    /**
235
     * @param string $file
236
     *
237
     * @return Version
238
     */
239
    public function setFile($file)
240
    {
241
        $this->file = $file;
242
        return $this;
243
    }
244
}
245