<?php
namespace App\Entity;
use App\Repository\VideoVisitRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=VideoVisitRepository::class)
*/
class VideoVisit
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=200)
*/
private $ip;
/**
* @ORM\Column(type="string", length=255)
*/
private $user_agent;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Video::class, inversedBy="visits")
* @ORM\JoinColumn(nullable=false)
*/
private $video;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
public function __construct()
{
$this->created_at=new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getIp(): ?string
{
return $this->ip;
}
public function setIp(string $ip): self
{
$this->ip = $ip;
return $this;
}
public function getUserAgent(): ?string
{
return $this->user_agent;
}
public function setUserAgent(string $user_agent): self
{
$this->user_agent = $user_agent;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getVideo(): ?Video
{
return $this->video;
}
public function setVideo(?Video $video): self
{
$this->video = $video;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->created_at;
}
public function setCreatedAt(\DateTime $created_at): self
{
$this->created_at = $created_at;
return $this;
}
}