Campaign::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Starkerxp\CampaignBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Starkerxp\StructureBundle\Entity\AbstractUser;
7
8
/**
9
 * Campaign.
10
 *
11
 * @ORM\Table(name="campaign", indexes={
12
 *  @ORM\Index(columns={"uuid"}),
13
 *  @ORM\Index(columns={"created_at"}),
14
 *  @ORM\Index(columns={"updated_at"}),
15
 *  @ORM\Index(columns={"name"}),
16
 *  @ORM\Index(columns={"deleted"}),
17
 *  @ORM\Index(columns={"status"})
18
 * })
19
 * @ORM\Entity(repositoryClass="Starkerxp\CampaignBundle\Repository\CampaignRepository")
20
 */
21
class Campaign extends AbstractUser
22
{
23
    const DRAFT = 'draft';
24
    const PENDING = 'pending';
25
    const SENT = 'send';
26
    const CANCEL = 'cancel';
27
    const ERROR = 'error';
28
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="name", type="string", length=255)
34
     */
35
    protected $name;
36
37
    /**
38
     * @var bool
39
     *
40
     * @ORM\Column(name="deleted", type="boolean", options={"default": false})
41
     */
42
    protected $deleted;
43
44
    /**
45
     * @var string
46
     *
47
     * @ORM\Column(name="status", type="string", length=255)
48
     */
49
    protected $status;
50
51
    /**
52
     * @var \DateTime
53
     *
54
     * @ORM\Column(name="date_start", type="datetime", nullable=true)
55
     */
56
    protected $dateStart;
57
58
    /**
59
     * @ORM\OneToMany(
60
     *      targetEntity="Event",
61
     *      mappedBy="campaign"
62
     * )
63
     */
64
    protected $events;
65
66
    /**
67
     * @ORM\OneToMany(
68
     *      targetEntity="CampaignTarget",
69
     *      mappedBy="campaign"
70
     * )
71
     */
72
    protected $targets;
73
74
    /**
75
     * Constructor
76
     */
77
    public function __construct()
78
    {
79
        $this->events = new \Doctrine\Common\Collections\ArrayCollection();
80
        $this->targets = new \Doctrine\Common\Collections\ArrayCollection();
81
        $this->status = self::DRAFT;
82
        $this->deleted = false;
83
    }
84
85
    /**
86
     * Get name.
87
     *
88
     * @return string
89
     */
90
    public function getName()
91
    {
92
        return $this->name;
93
    }
94
95
    /**
96
     * Set name.
97
     *
98
     * @param string $name
99
     *
100
     */
101
    public function setName($name)
102
    {
103
        $this->name = $name;
104
105
    }
106
107
    /**
108
     * Get status.
109
     *
110
     * @return string
111
     */
112
    public function getStatus()
113
    {
114
        return $this->status;
115
    }
116
117
    /**
118
     * Set status.
119
     *
120
     * @param string $status
121
     *
122
     */
123
    public function setStatus($status)
124
    {
125
        $this->status = $status;
126
    }
127
128
    /**
129
     * Get deleted.
130
     *
131
     * @return bool
132
     */
133
    public function getDeleted()
134
    {
135
        return $this->deleted;
136
    }
137
138
    /**
139
     * Set deleted.
140
     *
141
     * @param bool $deleted
142
     *
143
     */
144
    public function setDeleted($deleted)
145
    {
146
        $this->deleted = $deleted;
147
    }
148
149
    /**
150
     * Add event
151
     *
152
     * @param \Starkerxp\CampaignBundle\Entity\Event $event
153
     *
154
     * @return Campaign
155
     */
156
    public function addEvent(\Starkerxp\CampaignBundle\Entity\Event $event)
157
    {
158
        $this->events[] = $event;
159
160
        return $this;
161
    }
162
163
    /**
164
     * Remove event
165
     *
166
     * @param \Starkerxp\CampaignBundle\Entity\Event $event
167
     */
168
    public function removeEvent(\Starkerxp\CampaignBundle\Entity\Event $event)
169
    {
170
        $this->events->removeElement($event);
171
    }
172
173
    /**
174
     * Get events
175
     *
176
     * @return \Doctrine\Common\Collections\Collection
177
     */
178
    public function getEvents()
179
    {
180
        return $this->events;
181
    }
182
183
    /**
184
     * Add target
185
     *
186
     * @param \Starkerxp\CampaignBundle\Entity\CampaignTarget $target
187
     *
188
     * @return Campaign
189
     */
190
    public function addTarget(\Starkerxp\CampaignBundle\Entity\CampaignTarget $target)
191
    {
192
        $this->targets[] = $target;
193
194
        return $this;
195
    }
196
197
    /**
198
     * Remove target
199
     *
200
     * @param \Starkerxp\CampaignBundle\Entity\CampaignTarget $target
201
     */
202
    public function removeTarget(\Starkerxp\CampaignBundle\Entity\CampaignTarget $target)
203
    {
204
        $this->targets->removeElement($target);
205
    }
206
207
    /**
208
     * Get targets
209
     *
210
     * @return \Doctrine\Common\Collections\Collection
211
     */
212
    public function getTargets()
213
    {
214
        return $this->targets;
215
    }
216
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
217