Completed
Pull Request — development (#673)
by Nick
12:54 queued 04:44
created

FieldNote::setDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Oc\FieldNotes\Entity;
4
5
use Oc\GeoCache\Entity\Geocache;
0 ignored issues
show
introduced by
Use classes must be in alphabetical order.
Loading history...
6
use Oc\GeoCache\Entity\GeocacheLog;
7
use DateTime;
8
use Doctrine\ORM\Mapping as ORM;
9
10
/**
11
 * FieldNote
12
 *
13
 * @ORM\Table(name="field_note")
14
 * @ORM\Entity(repositoryClass="Oc\FieldNotes\Entity\FieldNoteRepository")
15
 */
16
class FieldNote
17
{
18
    const LOG_TYPE_FOUND = GeocacheLog::LOG_TYPE_FOUND;
19
    const LOG_TYPE_NOT_FOUND = GeocacheLog::LOG_TYPE_NOT_FOUND;
20
    const LOG_TYPE_NOTE = GeocacheLog::LOG_TYPE_NOTE;
21
    const LOG_TYPE_NEEDS_MAINTENANCE = 1000;
22
    
23
    /**
24
     * @var int
25
     *
26
     * @ORM\Column(name="id", type="integer")
27
     * @ORM\Id
28
     * @ORM\GeneratedValue(strategy="AUTO")
29
     */
30
    private $id;
31
32
    /**
33
     * @var User $user
0 ignored issues
show
introduced by
Invalid class name "User"
Loading history...
34
     *
35
     * @ORM\ManyToOne(targetEntity="\Oc\User\Entity\User")
36
     * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE")
37
     */
38
    private $user;
39
40
    /**
41
     * @var int
42
     *
43
     * @ORM\Column(name="type", type="smallint")
44
     */
45
    private $type;
46
47
    /**
48
     * @var \DateTime
49
     *
50
     * @ORM\Column(name="date", type="datetime")
51
     */
52
    private $date;
53
54
    /**
55
     * @var string
56
     *
57
     * @ORM\Column(name="text", type="string", length=255, nullable=true)
58
     */
59
    private $text;
60
61
    /**
62
     * @var Geocache
0 ignored issues
show
introduced by
Geocache => \Oc\GeoCache\Entity\Geocache
Loading history...
63
     *
64
     * @ORM\ManyToOne(targetEntity="\Oc\GeoCache\Entity\Geocache")
65
     * @ORM\JoinColumn(name="geocache_id", referencedColumnName="cache_id", onDelete="CASCADE")
66
     */
67
    private $geocache;
68
69
    /**
70
     * Get id
71
     *
72
     * @return int
73
     */
74
    public function getId()
75
    {
76
        return $this->id;
77
    }
78
79
    /**
80
     * Set type
81
     *
82
     * @param int $type
83
     *
84
     * @return FieldNote
0 ignored issues
show
introduced by
FieldNote => \Array\FieldNote
Loading history...
85
     */
86
    public function setType($type)
87
    {
88
        $this->type = $type;
89
90
        return $this;
91
    }
92
93
    /**
94
     * Get type
95
     *
96
     * @return int
97
     */
98
    public function getType()
99
    {
100
        return $this->type;
101
    }
102
103
    /**
104
     * Set date
105
     *
106
     * @param \DateTime $date
107
     *
108
     * @return FieldNote
0 ignored issues
show
introduced by
FieldNote => \Array\FieldNote
Loading history...
109
     */
110
    public function setDate(DateTime $date)
111
    {
112
        $this->date = $date;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Get date
119
     *
120
     * @return \DateTime
121
     */
122
    public function getDate()
123
    {
124
        return $this->date;
125
    }
126
127
    /**
128
     * Set text
129
     *
130
     * @param string $text
131
     *
132
     * @return FieldNote
0 ignored issues
show
introduced by
FieldNote => \Array\FieldNote
Loading history...
133
     */
134
    public function setText($text)
135
    {
136
        $text = str_replace("\n", '<br/>', $text);
137
        $this->text = $text;
138
139
        return $this;
140
    }
141
142
    /**
143
     * Get text
144
     *
145
     * @return string
146
     */
147
    public function getText()
148
    {
149
        return $this->text;
150
    }
151
152
    /**
153
     * Set user
154
     *
155
     * @param User|null $user
0 ignored issues
show
introduced by
Invalid class name "User"
Loading history...
156
     *
157
     * @return FieldNote
0 ignored issues
show
introduced by
FieldNote => \Array\FieldNote
Loading history...
158
     */
159
    public function setUser(User $user = null)
160
    {
161
        $this->user = $user;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Get user
168
     *
169
     * @return User
0 ignored issues
show
introduced by
Invalid class name "User"
Loading history...
170
     */
171
    public function getUser()
172
    {
173
        return $this->user;
174
    }
175
176
    /**
177
     * Set geocache
178
     *
179
     * @param Geocache|null $geocache
0 ignored issues
show
introduced by
Geocache => \Oc\GeoCache\Entity\Geocache
Loading history...
180
     *
181
     * @return FieldNote
0 ignored issues
show
introduced by
FieldNote => \Array\FieldNote
Loading history...
182
     */
183
    public function setGeocache(Geocache $geocache = null)
184
    {
185
        $this->geocache = $geocache;
186
187
        return $this;
188
    }
189
190
    /**
191
     * Get geocache
192
     *
193
     * @return Geocache
0 ignored issues
show
introduced by
Geocache => \Oc\GeoCache\Entity\Geocache
Loading history...
194
     */
195
    public function getGeocache()
196
    {
197
        return $this->geocache;
198
    }
199
}
200