Event::setStart()   A
last analyzed

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
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace BCRM\BackendBundle\Entity\Event;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use LiteCQRS\Plugin\CRUD\AggregateResource;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
11
/**
12
 * Event
13
 *
14
 * @ORM\Table(name="event")
15
 * @ORM\Entity(repositoryClass="BCRM\BackendBundle\Entity\Event\DoctrineEventRepository")
16
 */
17
class Event extends AggregateResource
18
{
19
    /**
20
     * @var integer
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     * @Assert\NotBlank()
30
     * @ORM\Column(type="text")
31
     */
32
    protected $name;
33
34
    /**
35
     * @var integer
36
     * @Assert\NotBlank()
37
     * @Assert\Type(type="integer")
38
     * @Assert\Range(min=1)
39
     * @ORM\Column(type="integer")
40
     */
41
    protected $capacity;
42
43
    /**
44
     * @var \DateTime
45
     * @ORM\Column(type="datetime")
46
     * @Assert\NotBlank()
47
     * @Assert\Type(type="\DateTime")
48
     */
49
    protected $start;
50
51
    /**
52
     * @var \DateTime
53
     * @ORM\Column(type="datetime", name="registration_start")
54
     * @Assert\NotBlank()
55
     * @Assert\Type(type="\DateTime")
56
     */
57
    protected $registrationStart;
58
59
    /**
60
     * @var \DateTime
61
     * @ORM\Column(type="datetime", name="registration_end")
62
     * @Assert\NotBlank()
63
     * @Assert\Type(type="\DateTime")
64
     */
65
    protected $registrationEnd;
66
67
    /**
68
     * Price for aticket in cents (including VAT)
69
     *
70
     * @var integer
71
     * @Assert\NotBlank()
72
     * @Assert\Type(type="integer")
73
     * @Assert\Range(min=1)
74
     * @ORM\Column(type="integer")
75
     */
76
    protected $price;
77
78
    /**
79
     * @Gedmo\Timestampable(on="create")
80
     * @ORM\Column(type="datetime")
81
     * @var \DateTime
82
     */
83
    protected $created;
84
85
    /**
86
     * @Gedmo\Timestampable(on="update")
87
     * @ORM\Column(type="datetime", nullable=true)
88
     * @var \DateTime
89
     */
90
    protected $updated;
91
92
    /**
93
     * @ORM\OneToMany(targetEntity="BCRM\BackendBundle\Entity\Event\Registration", mappedBy="event")
94
     * @var Registration[]
95
     */
96
    protected $registrations;
97
98
    /**
99
     * @ORM\OneToMany(targetEntity="BCRM\BackendBundle\Entity\Event\Unregistration", mappedBy="event")
100
     * @var Unregistration[]
101
     */
102
    protected $unregistrations;
103
104
    /**
105
     * @ORM\OneToMany(targetEntity="BCRM\BackendBundle\Entity\Event\Ticket", mappedBy="event")
106
     * @var Ticket[]
107
     */
108
    protected $tickets;
109
110
    /**
111
     * Get id
112
     *
113
     * @return integer
114
     */
115
    public function getId()
116
    {
117
        return $this->id;
118
    }
119
120
    /**
121
     * @return int
122
     */
123
    public function getCapacity()
124
    {
125
        return $this->capacity;
126
    }
127
128
    /**
129
     * @param int $capacity
130
     */
131
    public function setCapacity($capacity)
132
    {
133
        $this->capacity = (int)$capacity;
134
    }
135
136
    /**
137
     * @return string
138
     */
139
    public function getName()
140
    {
141
        return $this->name;
142
    }
143
144
    /**
145
     * @param string $name
146
     */
147
    public function setName($name)
148
    {
149
        $this->name = $name;
150
    }
151
152
    /**
153
     * @return int
154
     */
155
    public function getPrice()
156
    {
157
        return $this->price;
158
    }
159
160
    /**
161
     * @param int $price
162
     */
163
    public function setPrice($price)
164
    {
165
        $this->price = (int)$price;
166
    }
167
168
    /**
169
     * @return \DateTime
170
     */
171
    public function getRegistrationStart()
172
    {
173
        return $this->registrationStart;
174
    }
175
176
    /**
177
     * @param \DateTime $registrationStart
178
     */
179
    public function setRegistrationStart(\DateTime $registrationStart)
180
    {
181
        $this->registrationStart = $registrationStart;
182
    }
183
184
    /**
185
     * @return \DateTime
186
     */
187
    public function getStart()
188
    {
189
        return $this->start;
190
    }
191
192
    /**
193
     * @param \DateTime $start
194
     */
195
    public function setStart(\DateTime $start)
196
    {
197
        $this->start = $start;
198
    }
199
200
    public function __toString()
201
    {
202
        $str = $this->start->format('Y-m-d');
203
        return $str;
204
    }
205
206
    /**
207
     * @param \DateTime $registrationEnd
208
     */
209
    public function setRegistrationEnd(\DateTime $registrationEnd)
210
    {
211
        $this->registrationEnd = $registrationEnd;
212
    }
213
214
    /**
215
     * @return \DateTime
216
     */
217
    public function getRegistrationEnd()
218
    {
219
        return $this->registrationEnd;
220
    }
221
}
222
223