<?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\LanguageRepository")
* @ORM\Table(name="settings_language")
*/
class Language
{
/**
* @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=2, nullable=false)
*/
private $locale;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $icon;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $isLocked;
/**
* @ORM\OneToMany(targetEntity="\App\Entity\Settings\Phrase", mappedBy="language", cascade={"all"})
**/
private $phrases;
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());
$this->setIsLocked(false);
}
/**
* @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 getLocale()
{
return $this->locale;
}
public function setLocale(string $locale)
{
$this->locale = $locale;
}
public function getName()
{
return $this->name;
}
public function setName(string $name)
{
$this->name = $name;
}
public function getIcon()
{
return $this->icon;
}
public function setIcon($icon)
{
$this->icon = $icon;
}
public function setIsLocked($isLocked)
{
$this->isLocked = $isLocked;
}
public function getIsLocked()
{
return $this->isLocked;
}
public function getPhrases()
{
return $this->phrases;
}
}