src/Entity/Slave/JoinTableUserWarehouse.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_join_table_user_warehouse")
  9.  * @ORM\Entity
  10.  */
  11. class JoinTableUserWarehouse
  12. {
  13.     public function displayPermission(){
  14.         if($this->permission == 'R') return 'Lettura';
  15.         if($this->permission == 'RW') return 'Lettura/Scrittura';
  16.     }
  17.     /**
  18.      * @ORM\Column(name="id", type="bigint")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     protected $id;
  23.     
  24.     /**
  25.      * @ORM\Column(name="is_main", type="boolean")
  26.      */
  27.     protected $main false;
  28.     
  29.     /**
  30.      * @ORM\Column(name="permission", type="string")
  31.      */
  32.     protected $permission;
  33.     // ManyToOne
  34.         /**
  35.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\User", inversedBy="warehouses")
  36.          * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  37.          */
  38.         private $user;
  39.         /**
  40.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Warehouse", inversedBy="users")
  41.          * @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id")
  42.          */
  43.         private $warehouse;
  44.         public function getId(): ?string
  45.         {
  46.             return $this->id;
  47.         }
  48.         public function getPermission(): ?string
  49.         {
  50.             return $this->permission;
  51.         }
  52.         public function setPermission(string $permission): static
  53.         {
  54.             $this->permission $permission;
  55.             return $this;
  56.         }
  57.         public function getUser(): ?User
  58.         {
  59.             return $this->user;
  60.         }
  61.         public function setUser(?User $user): static
  62.         {
  63.             $this->user $user;
  64.             return $this;
  65.         }
  66.         public function getWarehouse(): ?Warehouse
  67.         {
  68.             return $this->warehouse;
  69.         }
  70.         public function setWarehouse(?Warehouse $warehouse): static
  71.         {
  72.             $this->warehouse $warehouse;
  73.             return $this;
  74.         }
  75.     public function isMain(): ?bool
  76.     {
  77.         return $this->main;
  78.     }
  79.     public function setMain(bool $main): static
  80.     {
  81.         $this->main $main;
  82.         return $this;
  83.     }
  84. }