src/Entity/Application.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\User\User;
  4. use App\Repository\ApplicationRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. /**
  8.  * @method string getUserIdentifier()
  9.  */
  10. #[ORM\Entity(repositoryClassApplicationRepository::class)]
  11. class Application implements UserInterface
  12. {
  13.     public const ROLE_BAD 0;
  14.     public const APPLICATION_ROLES = [
  15.         self::ROLE_BAD => 'application.department.bed'
  16.     ];
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(length100)]
  22.     private ?string $name null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $client_id null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $client_secret null;
  27.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'applications')]
  28.     private $user;
  29.     #[ORM\Column(type'json')]
  30.     private $roles = [];
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getName(): ?string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function setName(string $name): static
  40.     {
  41.         $this->name $name;
  42.         return $this;
  43.     }
  44.     public function getClientId(): ?string
  45.     {
  46.         return $this->client_id;
  47.     }
  48.     public function setClientId(?string $client_id): static
  49.     {
  50.         $this->client_id $client_id;
  51.         return $this;
  52.     }
  53.     public function getClientSecret(): ?string
  54.     {
  55.         return $this->client_secret;
  56.     }
  57.     public function setClientSecret(?string $client_secret): static
  58.     {
  59.         $this->client_secret $client_secret;
  60.         return $this;
  61.     }
  62.     public function getUser(): ?UserInterface
  63.     {
  64.         return $this->user;
  65.     }
  66.     public function setUser(?UserInterface $user): self
  67.     {
  68.         $this->user $user;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @see UserInterface
  73.      */
  74.     public function getUserIdentifier(): string
  75.     {
  76.         return (string) $this->client_id;
  77.     }
  78.     public function getRoles(): array
  79.     {
  80.         $roles $this->roles;
  81.         $roles[] = 'ROLE_SERVICE_APPLICATION';
  82.         return array_unique($roles);
  83.     }
  84.     public function setRoles(array $roles): self
  85.     {
  86.         $this->roles $roles;
  87.         return $this;
  88.     }
  89.     public function getPassword() { return null; }
  90.     public function getSalt() { return null; }
  91.     public function eraseCredentials() { return null; }
  92.     public function getUsername() { return null; }
  93. }