Completed
Push — development ( 4ecacc...c2cb07 )
by Thomas
18s
created

FieldNote::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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