src/Model/SecurityGroup/SecurityGroup.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Model\SecurityGroup;
  3. use App\Model\Customer\Customer;
  4. use App\Model\Traits\ImportableObjectTrait;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * Class SecurityGroup.
  9.  */
  10. class SecurityGroup
  11. {
  12.     use ImportableObjectTrait;
  13.     /**
  14.      * @var string|null
  15.      * @Groups({"list", "read", "write_put"})
  16.      */
  17.     private $id;
  18.     /**
  19.      * @Assert\NotNull
  20.      *
  21.      * @var string|null
  22.      * @Groups({"list", "read", "write_put"})
  23.      */
  24.     private $name;
  25.     /**
  26.      * @var Customer|null
  27.      * @Groups({"list", "read"})
  28.      */
  29.     private $customer;
  30.     /**
  31.      * @var array
  32.      * @Groups({"list", "read", "write_put"})
  33.      */
  34.     private $roles = [];
  35.     /**
  36.      * @var string|null
  37.      * @Groups({"list", "read", "write_put"})
  38.      */
  39.     private $usersFormatted;
  40.     /**
  41.      * @return string|null
  42.      */
  43.     public function getId(): ?string
  44.     {
  45.         return $this->id;
  46.     }
  47.     /**
  48.      * @param string|null $id
  49.      *
  50.      * @return SecurityGroup
  51.      */
  52.     public function setId(?string $id): SecurityGroup
  53.     {
  54.         $this->id $id;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return string|null
  59.      */
  60.     public function getName(): ?string
  61.     {
  62.         return $this->name;
  63.     }
  64.     /**
  65.      * @param string|null $name
  66.      *
  67.      * @return SecurityGroup
  68.      */
  69.     public function setName(?string $name): SecurityGroup
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return array
  76.      */
  77.     public function getRoles(): array
  78.     {
  79.         return $this->roles;
  80.     }
  81.     /**
  82.      * @param array $roles
  83.      *
  84.      * @return SecurityGroup
  85.      */
  86.     public function setRoles(array $roles): SecurityGroup
  87.     {
  88.         $this->roles $roles;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Customer|null
  93.      */
  94.     public function getCustomer(): ?Customer
  95.     {
  96.         return $this->customer;
  97.     }
  98.     /**
  99.      * @param Customer|null $customer
  100.      *
  101.      * @return SecurityGroup
  102.      */
  103.     public function setCustomer(?Customer $customer): SecurityGroup
  104.     {
  105.         $this->customer $customer;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return string|null
  110.      */
  111.     public function getCustomerName(): ?string
  112.     {
  113.         return $this->getCustomer() instanceof Customer $this->getCustomer()->getName() : '';
  114.     }
  115.     /**
  116.      * @return string
  117.      */
  118.     public function getNameForSelect(): string
  119.     {
  120.         return $this->getName().' - '.$this->getCustomerName();
  121.     }
  122.     /**
  123.      * @return string|null
  124.      */
  125.     public function getUsersFormatted(): ?string
  126.     {
  127.         return $this->usersFormatted;
  128.     }
  129.     /**
  130.      * @param string|null $usersFormatted
  131.      *
  132.      * @return SecurityGroup
  133.      */
  134.     public function setUsersFormatted(?string $usersFormatted): SecurityGroup
  135.     {
  136.         $this->usersFormatted $usersFormatted;
  137.         return $this;
  138.     }
  139. }