src/Entity/Settings/Phrase.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Settings;
  3. use Symfony\Component\Validator\Constraints AS Constraints;
  4. use Symfony\Component\Validator\Constraints AS Assert;
  5. use Doctrine\ORM\Mapping AS ORM;
  6. use Ramsey\Uuid\Uuid;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\Settings\PhraseRepository")
  9.  * @ORM\Table(name="settings_phrases")
  10.  */
  11. class Phrase
  12. {
  13.     /**
  14.     * @ORM\Id
  15.     * @ORM\GeneratedValue(strategy="AUTO")
  16.     * @ORM\Column(type="integer")
  17.     */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="uuid")
  21.      * @Assert\Uuid
  22.      */
  23.      protected $uuid;
  24.     /**
  25.      * @var \DateTime
  26.      *
  27.      * @ORM\Column(type="datetime", nullable=false)
  28.      */
  29.     private $created;
  30.     /**
  31.      * @var \DateTime
  32.      *
  33.      * @ORM\Column(type="datetime", nullable=false)
  34.      */
  35.     private $modified;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      */
  39.     private $text;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=false)
  42.      */
  43.     private $identifier;
  44.     /**
  45.      * @var \DateTime
  46.      *
  47.      * @ORM\Column(type="datetime", nullable=true)
  48.      */
  49.     private $lastUsed;
  50.     /**
  51.      * @ORM\ManyToOne(targetEntity="\App\Entity\Settings\Language", inversedBy="phrases")
  52.      **/
  53.     private $language;
  54.     public function __construct()
  55.     {
  56.         // UUID
  57.         if(!$this->getUuid())
  58.         {
  59.             $uuid Uuid::uuid1();
  60.             $this->setUuid($uuid->toString());
  61.         }
  62.         // Set some defaults
  63.         $this->setCreated(new \DateTime());
  64.         $this->setModified(new \DateTime());
  65.     }
  66.     
  67.     /**
  68.      * @ORM\PrePersist()
  69.      * @ORM\PreUpdate()
  70.      */
  71.     public function updateModified()
  72.     {
  73.         // Update modified
  74.         $this->setModified(new \DateTime());
  75.     }
  76.     
  77.     public function getId()
  78.     {
  79.         return $this->id;
  80.     }
  81.     public function setUuid($uuid)
  82.     {
  83.         $this->uuid $uuid;
  84.         return $this;
  85.     }
  86.     public function getUuid()
  87.     {
  88.         return $this->uuid;
  89.     }
  90.     public function setCreated(\DateTime $created)
  91.     {
  92.         $this->created $created;
  93.     }
  94.     public function getCreated()
  95.     {
  96.         return $this->created;
  97.     }
  98.     public function setModified(\DateTime $modified)
  99.     {
  100.         $this->modified $modified;
  101.     }
  102.     public function getModified()
  103.     {
  104.         return $this->modified;
  105.     }
  106.     public function getIdentifier()
  107.     {
  108.         return $this->identifier;
  109.     }
  110.     public function setIdentifier(string $identifier)
  111.     {
  112.         $this->identifier $identifier;
  113.     }
  114.     public function getText()
  115.     {
  116.         return $this->text;
  117.     }
  118.     public function setText(string $text)
  119.     {
  120.         $this->text $text;
  121.     }
  122.     public function getLastUsed()
  123.     {
  124.         return $this->lastUsed;
  125.     }
  126.     public function setLastUsed($lastUsed)
  127.     {
  128.         $this->lastUsed $lastUsed;
  129.     }
  130.     
  131.     public function setLanguage(\App\Entity\Settings\Language $language null)
  132.     {
  133.         $this->language $language;
  134.     }
  135.     public function getLanguage()
  136.     {
  137.         return $this->language;
  138.     }
  139. }