2015-03-02 17:39:45 +00:00
|
|
|
<?php
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
namespace App\Entity;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
2015-03-03 20:38:52 +00:00
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
/**
|
2015-03-03 20:38:52 +00:00
|
|
|
* @ORM\Table(name="copypastes", indexes={
|
|
|
|
* @ORM\Index(name="idx_expire", columns={"date_expire"})
|
|
|
|
* })
|
2015-03-02 17:39:45 +00:00
|
|
|
* @ORM\Entity
|
|
|
|
*/
|
2019-01-20 04:11:30 +00:00
|
|
|
class Paste
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var integer
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="id", type="integer")
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="text", type="text", nullable=false)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
|
|
|
private $text;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="description", type="text", nullable=true)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
2015-03-03 20:38:52 +00:00
|
|
|
private $description = null;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
/**
|
2015-03-02 20:12:49 +00:00
|
|
|
* @var Language
|
2015-03-02 17:39:45 +00:00
|
|
|
*
|
2015-03-02 20:12:49 +00:00
|
|
|
* @ORM\ManyToOne(targetEntity="Language")
|
|
|
|
* @ORM\JoinColumn(name="language_id", referencedColumnName="id")
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
|
|
|
private $language;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="file_name", type="string", length=128, nullable=true)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
2015-03-03 20:38:52 +00:00
|
|
|
private $fileName = null;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="author", type="string", length=48, nullable=true)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
2015-03-03 20:38:52 +00:00
|
|
|
private $author = null;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \DateTime
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="date_publish", type="datetime", nullable=false)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
|
|
|
private $datePublished;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \DateTime
|
|
|
|
*
|
2015-03-02 19:25:59 +00:00
|
|
|
* @ORM\Column(name="date_expire", type="datetime", nullable=true)
|
2015-03-02 17:39:45 +00:00
|
|
|
*/
|
2015-03-03 20:38:52 +00:00
|
|
|
private $dateExpire = null;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
2015-03-03 20:38:52 +00:00
|
|
|
* @Assert\Ip
|
2015-03-02 17:39:45 +00:00
|
|
|
* @ORM\Column(name="ip", type="string", length=48, nullable=false)
|
|
|
|
*/
|
|
|
|
private $ip;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*
|
|
|
|
* @ORM\Column(name="secret", type="string", length=16, nullable=true)
|
|
|
|
*/
|
2015-03-03 20:38:52 +00:00
|
|
|
private $secret = null;
|
2015-03-02 17:39:45 +00:00
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function __construct()
|
2015-03-03 20:38:52 +00:00
|
|
|
{
|
|
|
|
$this->datePublished = new \DateTime();
|
|
|
|
}
|
2015-03-02 17:39:45 +00:00
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getId(): int
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
2015-03-03 20:38:52 +00:00
|
|
|
|
|
|
|
public function __toString()
|
|
|
|
{
|
2015-05-28 01:03:38 +00:00
|
|
|
return (string) $this->id;
|
2015-03-03 20:38:52 +00:00
|
|
|
}
|
2015-03-02 17:39:45 +00:00
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setText(string $text): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->text = $text;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 04:11:30 +00:00
|
|
|
public function getText(): ?string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->text;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setDescription(string $description): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->description = $description;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getDescription(): ?string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setLanguage(Language $language): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->language = $language;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 04:11:30 +00:00
|
|
|
public function getLanguage(): ?Language
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->language;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setFilename(string $filename): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->fileName = $filename;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getFilename(): ?string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->fileName;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setAuthor(string $author): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->author = $author;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getAuthor(): ?string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->author;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getDatePublished(): \DateTime
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->datePublished;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setDateExpire(\DateTime $dateExpire): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->dateExpire = $dateExpire;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getDateExpire(): ?\DateTime
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->dateExpire;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setIp(string $ip): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->ip = $ip;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getIp(): string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->ip;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function setSecret(?string $secret): self
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
$this->secret = $secret;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2019-01-20 01:52:57 +00:00
|
|
|
public function getSecret(): ?string
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return $this->secret;
|
|
|
|
}
|
2019-01-20 01:52:57 +00:00
|
|
|
|
|
|
|
public function isPrivate(): bool
|
2015-03-02 17:39:45 +00:00
|
|
|
{
|
|
|
|
return ($this->secret === null) ? false : true;
|
|
|
|
}
|
|
|
|
}
|