zend-blog-3-backend

Форк
0
314 строк · 5.4 Кб
1
<?php
2

3
namespace App\Entity;
4

5
use DateTime;
6
use Doctrine\ORM\Mapping as ORM;
7

8
/**
9
 * @ORM\Table(name="tracking")
10
 * @ORM\Entity(repositoryClass="App\Repository\TrackingRepository")
11
 */
12
class Tracking
13
{
14
    /**
15
     * @var int
16
     *
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    protected $id;
22

23
    /**
24
     * @var \App\Entity\Post
25
     *
26
     * @ORM\ManyToOne(targetEntity="Post")
27
     * @ORM\JoinColumn(onDelete="CASCADE")
28
     */
29
    protected $post;
30

31
    /**
32
     * @var \App\Entity\TrackingAgent
33
     *
34
     * @ORM\ManyToOne(targetEntity="TrackingAgent", inversedBy="trackings")
35
     * @ORM\JoinColumn(name="user_agent_id", referencedColumnName="id", onDelete="SET NULL")
36
     */
37
    protected $trackingAgent;
38

39
    /**
40
     * @var string
41
     *
42
     * @ORM\Column(name="ip_addr", type="string", length=15, nullable=true)
43
     */
44
    protected $ipAddress;
45

46
    /**
47
     * @var GeoLocation
48
     *
49
     * @ORM\ManyToOne(targetEntity="GeoLocation")
50
     * @ORM\JoinColumn(name="ip_long", referencedColumnName="ip_long", onDelete="SET NULL")
51
     */
52
    private $geoLocation;
53

54
    /**
55
     * @var DateTime
56
     *
57
     * @ORM\Column(type="milliseconds_dt")
58
     */
59
    protected $timeCreated;
60

61
    /**
62
     * @var bool
63
     *
64
     * @ORM\Column(name="is_cdn", type="boolean", options={"default": false})
65
     */
66
    private $cdn;
67

68
    /**
69
     * @var string|null
70
     *
71
     * @ORM\Column(type="string", length=128, nullable=true)
72
     */
73
    private $requestURI;
74

75
    /**
76
     * @var int|null
77
     *
78
     * @ORM\Column(type="smallint", nullable=true)
79
     */
80
    private $statusCode;
81

82
    /**
83
     * @var int
84
     *
85
     * @ORM\Column(type="integer", options={"unsigned": true, "default": 0})
86
     */
87
    private $duration = 0;
88

89
    /**
90
     * @var string|null
91
     *
92
     * @ORM\Column(type="string", length=8, nullable=true)
93
     */
94
    private $method;
95

96
    public function __construct()
97
    {
98
        $this->cdn = false;
99

100
        $this->setTimeCreated(new DateTime());
101
    }
102

103
    /**
104
     * Get id
105
     *
106
     * @return int
107
     */
108
    public function getId()
109
    {
110
        return $this->id;
111
    }
112

113
    /**
114
     * Set ipAddress
115
     *
116
     * @param string $ipAddress
117
     *
118
     * @return Tracking
119
     */
120
    public function setIpAddress($ipAddress)
121
    {
122
        $this->ipAddress = $ipAddress;
123

124
        return $this;
125
    }
126

127
    /**
128
     * Get ipAddress
129
     *
130
     * @return string
131
     */
132
    public function getIpAddress()
133
    {
134
        return $this->ipAddress;
135
    }
136

137
    /**
138
     * Set timeCreated
139
     *
140
     * @param DateTime $timeCreated
141
     *
142
     * @return Tracking
143
     */
144
    public function setTimeCreated(DateTime $timeCreated)
145
    {
146
        $this->timeCreated = $timeCreated;
147

148
        return $this;
149
    }
150

151
    /**
152
     * Get timeCreated
153
     *
154
     * @return DateTime
155
     */
156
    public function getTimeCreated()
157
    {
158
        return $this->timeCreated;
159
    }
160

161
    /**
162
     * Set trackingAgent
163
     *
164
     * @param TrackingAgent $trackingAgent
165
     *
166
     * @return Tracking
167
     */
168
    public function setTrackingAgent(TrackingAgent $trackingAgent = null)
169
    {
170
        $this->trackingAgent = $trackingAgent;
171

172
        return $this;
173
    }
174

175
    /**
176
     * Get trackingAgent
177
     *
178
     * @return TrackingAgent
179
     */
180
    public function getTrackingAgent()
181
    {
182
        return $this->trackingAgent;
183
    }
184

185
    /**
186
     * Set post
187
     *
188
     * @param Post $post
189
     *
190
     * @return Tracking
191
     */
192
    public function setPost(Post $post = null)
193
    {
194
        $this->post = $post;
195

196
        return $this;
197
    }
198

199
    /**
200
     * Get post
201
     *
202
     * @return Post
203
     */
204
    public function getPost()
205
    {
206
        return $this->post;
207
    }
208

209
    /**
210
     * @return bool
211
     */
212
    public function isCdn(): bool
213
    {
214
        return $this->cdn;
215
    }
216

217
    /**
218
     * @param bool $cdn
219
     *
220
     * @return Tracking
221
     */
222
    public function setCdn(bool $cdn): Tracking
223
    {
224
        $this->cdn = $cdn;
225

226
        return $this;
227
    }
228

229
    /**
230
     * @return string|null
231
     */
232
    public function getRequestURI(): ?string
233
    {
234
        return $this->requestURI;
235
    }
236

237
    /**
238
     * @param string|null $requestURI
239
     *
240
     * @return Tracking
241
     */
242
    public function setRequestURI(string $requestURI = null): self
243
    {
244
        $this->requestURI = $requestURI;
245

246
        return $this;
247
    }
248

249
    /**
250
     * @return int|null
251
     */
252
    public function getStatusCode(): ?int
253
    {
254
        return $this->statusCode;
255
    }
256

257
    /**
258
     * @param int|null $statusCode
259
     *
260
     * @return Tracking
261
     */
262
    public function setStatusCode(int $statusCode = null): self
263
    {
264
        $this->statusCode = $statusCode;
265

266
        return $this;
267
    }
268

269
    /**
270
     * Get geoLocation
271
     *
272
     * @return GeoLocation|null
273
     */
274
    public function getGeoLocation(): ?GeoLocation
275
    {
276
        return $this->geoLocation;
277
    }
278

279
    /**
280
     * @param GeoLocation|null $location
281
     *
282
     * @return $this
283
     */
284
    public function setGeoLocation(GeoLocation $location = null): self
285
    {
286
        $this->geoLocation = $location;
287

288
        return $this;
289
    }
290

291
    public function getDuration(): int
292
    {
293
        return $this->duration;
294
    }
295

296
    public function setDuration(int $duration): self
297
    {
298
        $this->duration = $duration;
299

300
        return $this;
301
    }
302

303
    public function getMethod(): ?string
304
    {
305
        return $this->method;
306
    }
307

308
    public function setMethod(string $method = null): self
309
    {
310
        $this->method = $method;
311

312
        return $this;
313
    }
314
}
315

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.