2016-04-17 11:46:35 +03:00
|
|
|
<?php
|
|
|
|
namespace Acelaya\UrlShortener\Entity;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Visit
|
|
|
|
* @author
|
|
|
|
* @link
|
|
|
|
*
|
|
|
|
* @ORM\Entity
|
|
|
|
* @ORM\Table(name="visits")
|
|
|
|
*/
|
|
|
|
class Visit extends AbstractEntity
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
2016-04-30 20:18:42 +03:00
|
|
|
* @ORM\Column(type="string", length=256, nullable=true)
|
2016-04-17 11:46:35 +03:00
|
|
|
*/
|
|
|
|
protected $referer;
|
|
|
|
/**
|
|
|
|
* @var \DateTime
|
|
|
|
* @ORM\Column(type="datetime", nullable=false)
|
|
|
|
*/
|
|
|
|
protected $date;
|
|
|
|
/**
|
|
|
|
* @var string
|
2016-04-30 20:18:42 +03:00
|
|
|
* @ORM\Column(type="string", length=256, name="remote_addr", nullable=true)
|
2016-04-17 11:46:35 +03:00
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
protected $remoteAddr;
|
2016-04-17 11:46:35 +03:00
|
|
|
/**
|
|
|
|
* @var string
|
2016-04-30 20:18:42 +03:00
|
|
|
* @ORM\Column(type="string", length=256, name="user_agent", nullable=true)
|
2016-04-17 11:46:35 +03:00
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
protected $userAgent;
|
2016-04-17 11:46:35 +03:00
|
|
|
/**
|
|
|
|
* @var ShortUrl
|
|
|
|
* @ORM\ManyToOne(targetEntity=ShortUrl::class)
|
|
|
|
* @ORM\JoinColumn(name="short_url_id", referencedColumnName="id")
|
|
|
|
*/
|
|
|
|
protected $shortUrl;
|
|
|
|
|
2016-04-30 20:18:42 +03:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->date = new \DateTime();
|
|
|
|
}
|
|
|
|
|
2016-04-17 11:46:35 +03:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getReferer()
|
|
|
|
{
|
|
|
|
return $this->referer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $referer
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function setReferer($referer)
|
|
|
|
{
|
|
|
|
$this->referer = $referer;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \DateTime
|
|
|
|
*/
|
|
|
|
public function getDate()
|
|
|
|
{
|
|
|
|
return $this->date;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \DateTime $date
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function setDate($date)
|
|
|
|
{
|
|
|
|
$this->date = $date;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-04-30 20:18:42 +03:00
|
|
|
* @return ShortUrl
|
2016-04-17 11:46:35 +03:00
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function getShortUrl()
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
return $this->shortUrl;
|
2016-04-17 11:46:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-04-30 20:18:42 +03:00
|
|
|
* @param ShortUrl $shortUrl
|
2016-04-17 11:46:35 +03:00
|
|
|
* @return $this
|
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function setShortUrl($shortUrl)
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
$this->shortUrl = $shortUrl;
|
2016-04-17 11:46:35 +03:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function getRemoteAddr()
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
return $this->remoteAddr;
|
2016-04-17 11:46:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-04-30 20:18:42 +03:00
|
|
|
* @param string $remoteAddr
|
2016-04-17 11:46:35 +03:00
|
|
|
* @return $this
|
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function setRemoteAddr($remoteAddr)
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
$this->remoteAddr = $remoteAddr;
|
2016-04-17 11:46:35 +03:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function getUserAgent()
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
return $this->userAgent;
|
2016-04-17 11:46:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-04-30 20:18:42 +03:00
|
|
|
* @param string $userAgent
|
2016-04-17 11:46:35 +03:00
|
|
|
* @return $this
|
|
|
|
*/
|
2016-04-30 20:18:42 +03:00
|
|
|
public function setUserAgent($userAgent)
|
2016-04-17 11:46:35 +03:00
|
|
|
{
|
2016-04-30 20:18:42 +03:00
|
|
|
$this->userAgent = $userAgent;
|
2016-04-17 11:46:35 +03:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|