<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\HeadquarterRepository")
*/
class HeadquarterConfig
{
/**
* @var int
*
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="json", nullable=true)
*/
private ?array $userTypes = null;
public function getId(): ?int
{
return $this->id;
}
public function getUserTypes(): ?array
{
return $this->userTypes;
}
public function getUserTypeLabel(?int $id): ?string
{
if (!$this->userTypes || $id === null) {
return null;
}
foreach ($this->userTypes as $type) {
if (($type['id'] ?? null) === $id) {
return $type['label'] ?? null;
}
}
return null;
}
public function setUserTypes(?array $userTypes): self
{
$this->userTypes = $userTypes;
return $this;
}
}