zend-blog-3-backend
153 строки · 2.6 Кб
1<?php
2/**
3* Created by PhpStorm.
4* User: morontt
5* Date: 13.11.16
6* Time: 11:58
7*/
8
9namespace App\Entity;
10
11use DateTime;
12use Doctrine\ORM\Mapping as ORM;
13
14/**
15* @ORM\Table()
16* @ORM\Entity(repositoryClass="App\Repository\GeoLocationRepository")
17*/
18class 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*/
28private $id;
29
30/**
31* @var string
32*
33* @ORM\Column(name="ip_addr", type="string", length=15, unique=true)
34*/
35private $ipAddress;
36
37/**
38* @var GeoLocationCity
39*
40* @ORM\ManyToOne(targetEntity="GeoLocationCity")
41* @ORM\JoinColumn(nullable=true, onDelete="RESTRICT")
42*/
43private $city;
44
45/**
46* @var DateTime
47*
48* @ORM\Column(type="milliseconds_dt")
49*/
50private $timeCreated;
51
52/**
53* @var int
54*
55* @ORM\Column(type="smallint", options={"unsigned": true, "default": 0})
56*/
57private $countOfCheck = 0;
58
59public function __construct()
60{
61$this->timeCreated = new DateTime();
62}
63
64/**
65* Get id
66*
67* @return int
68*/
69public function getId()
70{
71return $this->id;
72}
73
74/**
75* Set ipAddress
76*
77* @param string $ipAddress
78*
79* @return GeoLocation
80*/
81public function setIpAddress($ipAddress)
82{
83$this->ipAddress = $ipAddress;
84
85return $this;
86}
87
88/**
89* Get ipAddress
90*
91* @return string
92*/
93public function getIpAddress()
94{
95return $this->ipAddress;
96}
97
98/**
99* Set city
100*
101* @param GeoLocationCity|null $city
102*
103* @return GeoLocation
104*/
105public function setCity(GeoLocationCity $city = null)
106{
107$this->city = $city;
108
109return $this;
110}
111
112/**
113* Get city
114*
115* @return GeoLocationCity
116*/
117public function getCity()
118{
119return $this->city;
120}
121
122/**
123* Set timeCreated
124*
125* @param DateTime $timeCreated
126*
127* @return GeoLocation
128*/
129public function setTimeCreated($timeCreated)
130{
131$this->timeCreated = $timeCreated;
132
133return $this;
134}
135
136/**
137* Get timeCreated
138*
139* @return DateTime
140*/
141public function getTimeCreated()
142{
143return $this->timeCreated;
144}
145
146/**
147* @return void
148*/
149public function increaseCountOfCheck()
150{
151$this->countOfCheck++;
152}
153}
154