<?php
namespace App\Entity\Settings;
use Symfony\Component\Validator\Constraints AS Constraints;
use Symfony\Component\Validator\Constraints AS Assert;
use Doctrine\ORM\Mapping AS ORM;
use Ramsey\Uuid\Uuid;
/**
* @ORM\Entity(repositoryClass="App\Repository\Settings\PhraseRepository")
* @ORM\Table(name="settings_phrases")
*/
class Phrase
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="uuid")
* @Assert\Uuid
*/
protected $uuid;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime", nullable=false)
*/
private $created;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime", nullable=false)
*/
private $modified;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $text;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $identifier;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime", nullable=true)
*/
private $lastUsed;
/**
* @ORM\ManyToOne(targetEntity="\App\Entity\Settings\Language", inversedBy="phrases")
**/
private $language;
public function __construct()
{
// UUID
if(!$this->getUuid())
{
$uuid = Uuid::uuid1();
$this->setUuid($uuid->toString());
}
// Set some defaults
$this->setCreated(new \DateTime());
$this->setModified(new \DateTime());
}
/**
* @ORM\PrePersist()
* @ORM\PreUpdate()
*/
public function updateModified()
{
// Update modified
$this->setModified(new \DateTime());
}
public function getId()
{
return $this->id;
}
public function setUuid($uuid)
{
$this->uuid = $uuid;
return $this;
}
public function getUuid()
{
return $this->uuid;
}
public function setCreated(\DateTime $created)
{
$this->created = $created;
}
public function getCreated()
{
return $this->created;
}
public function setModified(\DateTime $modified)
{
$this->modified = $modified;
}
public function getModified()
{
return $this->modified;
}
public function getIdentifier()
{
return $this->identifier;
}
public function setIdentifier(string $identifier)
{
$this->identifier = $identifier;
}
public function getText()
{
return $this->text;
}
public function setText(string $text)
{
$this->text = $text;
}
public function getLastUsed()
{
return $this->lastUsed;
}
public function setLastUsed($lastUsed)
{
$this->lastUsed = $lastUsed;
}
public function setLanguage(\App\Entity\Settings\Language $language = null)
{
$this->language = $language;
}
public function getLanguage()
{
return $this->language;
}
}