src/Entity/RolePermission.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RolePermissionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=RolePermissionRepository::class)
  7.  * @ORM\Table(name="role_permission", uniqueConstraints={@ORM\UniqueConstraint(columns={"role_id","permission_id"})})
  8.  */
  9. class RolePermission
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private ?int $id null;
  17.     /**
  18.      * @ORM\ManyToOne(targetEntity=Roles::class)
  19.      * @ORM\JoinColumn(name="role_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  20.      */
  21.     private ?Roles $role null;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Permission::class)
  24.      * @ORM\JoinColumn(name="permission_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  25.      */
  26.     private ?Permission $permission null;
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getRole(): ?Roles
  32.     {
  33.         return $this->role;
  34.     }
  35.     public function setRole(Roles $role): self
  36.     {
  37.         $this->role $role;
  38.         return $this;
  39.     }
  40.     public function getPermission(): ?Permission
  41.     {
  42.         return $this->permission;
  43.     }
  44.     public function setPermission(Permission $permission): self
  45.     {
  46.         $this->permission $permission;
  47.         return $this;
  48.     }
  49. }