src/Entity/Role.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RoleRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Table(name"role")]
  6. #[ORM\Entity(repositoryClassRoleRepository::class)]
  7. class Role {
  8.     const ROLE_DIPLOME 'ROLE_DIPLOME';
  9.     const ROLE_ENTREPRISE 'ROLE_ENTREPRISE';
  10.     const ROLE_ADMIN 'ROLE_ADMIN';
  11.     const ROLE_ETABLISSEMENT 'ROLE_ETABLISSEMENT';
  12.     const ROLE_PRINCIPAL 'ROLE_PRINCIPAL';
  13.     const ROLE_ADMIN_PAYS 'ROLE_ADMIN_PAYS';
  14.     const ROLE_ADMIN_REGIONS 'ROLE_ADMIN_REGIONS';
  15.     const ROLE_ADMIN_VILLES 'ROLE_ADMIN_VILLES';
  16.     const ROLE_DIRECTOR 'ROLE_DIRECTEUR';
  17.     const ROLE_LEGISLATOR 'ROLE_LEGISLATEUR';
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column(type'integer')]
  21.     private ?int $id null;
  22.     #[ORM\Column(name'role'type'string'length100uniquetrue)]
  23.     private ?string $role;
  24.     #[ORM\Column(name'pseudo'type'string'length100nullabletrue)]
  25.     private ?string $pseudo;
  26.     /**
  27.      * Role constructor.
  28.      * @param string|null $role
  29.      */
  30.     public function __construct(string $role null) {
  31.         $this->role $role;
  32.     }
  33.     public function getId(): ?int {
  34.         return $this->id;
  35.     }
  36.     public function getRole(): ?string {
  37.         return $this->role;
  38.     }
  39.     public function setRole(string $role) {
  40.         $this->role strtoupper($role);
  41.         return $this;
  42.     }
  43.     public function getPseudo(): ?string
  44.     {
  45.         return strlen($this->pseudo)>$this->pseudo $this->role;
  46.     }
  47.     /**
  48.      * @param string|null $pseudo
  49.      * @return Role
  50.      */
  51.     public function setPseudo(?string $pseudo): Role
  52.     {
  53.         $this->pseudo $pseudo;
  54.         return $this;
  55.     }
  56.     public function __toString() {
  57.         // return $this->role;
  58.         return strlen($this->pseudo)>$this->pseudo $this->role;
  59.     }
  60. }