src/Entity/UserInstitutionRole.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Mapped\Entity;
  4. use App\Repository\UserInstitutionRoleRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(
  8.     repositoryClassUserInstitutionRoleRepository::class
  9. )]
  10. #[ORM\Table(
  11.     name'user_role_institution'
  12. )]
  13. class UserInstitutionRole extends Entity
  14. {
  15.     #[ORM\ManyToOne(
  16.         targetEntityUserInstitution::class,
  17.         cascade: ['persist'],
  18.         inversedBy'roles'
  19.     )]
  20.     #[ORM\JoinColumn(
  21.         name'user_institution',
  22.         onDelete'CASCADE'
  23.     )]
  24.     private ?UserInstitution $userInstitution null;
  25.     #[ORM\ManyToOne(
  26.         targetEntityRole::class,
  27.         cascade: ['persist']
  28.     )]
  29.     #[ORM\JoinColumn(
  30.         name'role',
  31.         onDelete'CASCADE'
  32.     )]
  33.     #[Assert\NotBlank(
  34.         groups: ['admin-action-create''admin-action-update']
  35.     )]
  36.     private ?Role $role null;
  37.     #[ORM\Column(
  38.         name'current',
  39.         type'boolean',
  40.         nullabletrue
  41.     )]
  42.     private ?bool $current false;
  43.     public function getUserInstitution(): ?UserInstitution
  44.     {
  45.         return $this->userInstitution;
  46.     }
  47.     public function setUserInstitution(?UserInstitution $userInstitution): self
  48.     {
  49.         $this->userInstitution $userInstitution;
  50.         return $this;
  51.     }
  52.     public function getRole(): ?Role
  53.     {
  54.         return $this->role;
  55.     }
  56.     public function setRole(?Role $role): self
  57.     {
  58.         $this->role $role;
  59.         return $this;
  60.     }
  61.     public function isCurrent(): ?bool
  62.     {
  63.         return $this->current;
  64.     }
  65.     public function setCurrent(?bool $current): self
  66.     {
  67.         $this->current $current;
  68.         return $this;
  69.     }
  70. }