src/Entity/Users/Permission.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Users;
  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\Users\PermissionRepository")
  9.  * @ORM\Table(name="users_permission")
  10.  */
  11. class Permission
  12. {
  13.     /**
  14.     * @ORM\Column(type="integer")
  15.     * @ORM\Id
  16.     * @ORM\GeneratedValue(strategy="AUTO")
  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 string
  32.     *
  33.     * @ORM\Column(type="string", length=255, nullable=false)
  34.     */
  35.     private $name;
  36.     /**
  37.     * @var string
  38.     *
  39.     * @ORM\Column(type="string", length=100, nullable=false)
  40.     */
  41.     private $identifier;
  42.     /**
  43.     * @var string
  44.     *
  45.     * @ORM\Column(type="string", length=255, nullable=false)
  46.     */
  47.     private $category;
  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.     }
  59.     public function getId()
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function setUuid($uuid)
  64.     {
  65.         $this->uuid $uuid;
  66.         return $this;
  67.     }
  68.     public function getUuid()
  69.     {
  70.         return $this->uuid;
  71.     }
  72.     public function setCreated($created)
  73.     {
  74.         $this->created $created;
  75.         return $this;
  76.     }
  77.     public function getCreated()
  78.     {
  79.         return $this->created;
  80.     }
  81.     public function setName($name)
  82.     {
  83.         $this->name $name;
  84.         return $this;
  85.     }
  86.     public function getName()
  87.     {
  88.         return $this->name;
  89.     }
  90.     public function setIdentifier($identifier)
  91.     {
  92.         $this->identifier $identifier;
  93.         return $this;
  94.     }
  95.     public function getIdentifier()
  96.     {
  97.         return $this->identifier;
  98.     }
  99.     public function setCategory($category)
  100.     {
  101.         $this->category $category;
  102.         return $this;
  103.     }
  104.     public function getCategory()
  105.     {
  106.         return $this->category;
  107.     }
  108. }