src/Entity/HeadquarterConfig.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\HeadquarterRepository")
  6.  */
  7. class HeadquarterConfig
  8. {
  9.     /**
  10.      * @var int
  11.      *
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="json", nullable=true)
  19.      */
  20.     private ?array $userTypes null;
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getUserTypes(): ?array
  26.     {
  27.         return $this->userTypes;
  28.     }
  29.     public function getUserTypeLabel(?int $id): ?string
  30.     {
  31.         if (!$this->userTypes || $id === null) {
  32.             return null;
  33.         }
  34.         foreach ($this->userTypes as $type) {
  35.             if (($type['id'] ?? null) === $id) {
  36.                 return $type['label'] ?? null;
  37.             }
  38.         }
  39.         return null;
  40.     }
  41.     public function setUserTypes(?array $userTypes): self
  42.     {
  43.         $this->userTypes $userTypes;
  44.         return $this;
  45.     }
  46. }