<?phpnamespace App\Entity;use App\Entity\User\User;use App\Repository\ApplicationRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\UserInterface;/** * @method string getUserIdentifier() */#[ORM\Entity(repositoryClass: ApplicationRepository::class)]class Application implements UserInterface{ public const ROLE_BAD = 0; public const APPLICATION_ROLES = [ self::ROLE_BAD => 'application.department.bed' ]; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 100)] private ?string $name = null; #[ORM\Column(length: 255, nullable: true)] private ?string $client_id = null; #[ORM\Column(length: 255, nullable: true)] private ?string $client_secret = null; #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'applications')] private $user; #[ORM\Column(type: 'json')] private $roles = []; public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getClientId(): ?string { return $this->client_id; } public function setClientId(?string $client_id): static { $this->client_id = $client_id; return $this; } public function getClientSecret(): ?string { return $this->client_secret; } public function setClientSecret(?string $client_secret): static { $this->client_secret = $client_secret; return $this; } public function getUser(): ?UserInterface { return $this->user; } public function setUser(?UserInterface $user): self { $this->user = $user; return $this; } /** * @see UserInterface */ public function getUserIdentifier(): string { return (string) $this->client_id; } public function getRoles(): array { $roles = $this->roles; $roles[] = 'ROLE_SERVICE_APPLICATION'; return array_unique($roles); } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function getPassword() { return null; } public function getSalt() { return null; } public function eraseCredentials() { return null; } public function getUsername() { return null; }}