src/Entity/System/Config.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  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\System\ConfigRepository")
  9.  * @ORM\Table(name="system_config")
  10.  */
  11. class Config
  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(name="`key`", type="string", length=60, nullable=false)
  38.      */
  39.     private $key;
  40.     /**
  41.      * @ORM\Column(type="text", nullable=true)
  42.      */
  43.     private $value;
  44.     /**
  45.      * @ORM\Column(type="string", length=60, nullable=false)
  46.      */
  47.     private $label;
  48.     public function __construct()
  49.     {
  50.         // UUID
  51.         if(!$this->getUuid())
  52.         {
  53.             $uuid Uuid::uuid1();
  54.             $this->setUuid($uuid->toString());
  55.         }
  56.         // Set some defaults
  57.         $this->setCreated(new \DateTime());
  58.         $this->setModified(new \DateTime());
  59.     }
  60.     public function getId()
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function setUuid($uuid)
  65.     {
  66.         $this->uuid $uuid;
  67.         return $this;
  68.     }
  69.     public function getUuid()
  70.     {
  71.         return $this->uuid;
  72.     }
  73.     public function setCreated(\DateTime $created)
  74.     {
  75.         $this->created $created;
  76.     }
  77.     public function getCreated()
  78.     {
  79.         return $this->created;
  80.     }
  81.     public function setModified(\DateTime $modified)
  82.     {
  83.         $this->modified $modified;
  84.     }
  85.     public function getModified()
  86.     {
  87.         return $this->modified;
  88.     }
  89.     public function getKey()
  90.     {
  91.         return $this->key;
  92.     }
  93.     public function setKey(string $key)
  94.     {
  95.         $this->key $key;
  96.     }
  97.     public function getValue()
  98.     {
  99.         return $this->value;
  100.     }
  101.     public function setValue($value)
  102.     {
  103.         $this->value $value;
  104.     }
  105.     public function getLabel()
  106.     {
  107.         return $this->label;
  108.     }
  109.     public function setLabel(string $label)
  110.     {
  111.         $this->label $label;
  112.     }
  113. }