zend-blog-3-backend

Форк
0
/
GeoLocation.php 
153 строки · 2.6 Кб
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: morontt
5
 * Date: 13.11.16
6
 * Time: 11:58
7
 */
8

9
namespace App\Entity;
10

11
use DateTime;
12
use Doctrine\ORM\Mapping as ORM;
13

14
/**
15
 * @ORM\Table()
16
 * @ORM\Entity(repositoryClass="App\Repository\GeoLocationRepository")
17
 */
18
class GeoLocation
19
{
20
    /**
21
     * @var int
22
     *
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="CUSTOM")
25
     * @ORM\CustomIdGenerator(class="App\Doctrine\ORM\IpLongIdGenerator")
26
     * @ORM\Column(name="ip_long", type="integer", options={"unsigned": true})
27
     */
28
    private $id;
29

30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(name="ip_addr", type="string", length=15, unique=true)
34
     */
35
    private $ipAddress;
36

37
    /**
38
     * @var GeoLocationCity
39
     *
40
     * @ORM\ManyToOne(targetEntity="GeoLocationCity")
41
     * @ORM\JoinColumn(nullable=true, onDelete="RESTRICT")
42
     */
43
    private $city;
44

45
    /**
46
     * @var DateTime
47
     *
48
     * @ORM\Column(type="milliseconds_dt")
49
     */
50
    private $timeCreated;
51

52
    /**
53
     * @var int
54
     *
55
     * @ORM\Column(type="smallint", options={"unsigned": true, "default": 0})
56
     */
57
    private $countOfCheck = 0;
58

59
    public function __construct()
60
    {
61
        $this->timeCreated = new DateTime();
62
    }
63

64
    /**
65
     * Get id
66
     *
67
     * @return int
68
     */
69
    public function getId()
70
    {
71
        return $this->id;
72
    }
73

74
    /**
75
     * Set ipAddress
76
     *
77
     * @param string $ipAddress
78
     *
79
     * @return GeoLocation
80
     */
81
    public function setIpAddress($ipAddress)
82
    {
83
        $this->ipAddress = $ipAddress;
84

85
        return $this;
86
    }
87

88
    /**
89
     * Get ipAddress
90
     *
91
     * @return string
92
     */
93
    public function getIpAddress()
94
    {
95
        return $this->ipAddress;
96
    }
97

98
    /**
99
     * Set city
100
     *
101
     * @param GeoLocationCity|null $city
102
     *
103
     * @return GeoLocation
104
     */
105
    public function setCity(GeoLocationCity $city = null)
106
    {
107
        $this->city = $city;
108

109
        return $this;
110
    }
111

112
    /**
113
     * Get city
114
     *
115
     * @return GeoLocationCity
116
     */
117
    public function getCity()
118
    {
119
        return $this->city;
120
    }
121

122
    /**
123
     * Set timeCreated
124
     *
125
     * @param DateTime $timeCreated
126
     *
127
     * @return GeoLocation
128
     */
129
    public function setTimeCreated($timeCreated)
130
    {
131
        $this->timeCreated = $timeCreated;
132

133
        return $this;
134
    }
135

136
    /**
137
     * Get timeCreated
138
     *
139
     * @return DateTime
140
     */
141
    public function getTimeCreated()
142
    {
143
        return $this->timeCreated;
144
    }
145

146
    /**
147
     * @return void
148
     */
149
    public function increaseCountOfCheck()
150
    {
151
        $this->countOfCheck++;
152
    }
153
}
154

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

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

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

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