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.     //
  45.     public function getId(): ?string
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getPermission(): ?string
  50.     {
  51.         return $this->permission;
  52.     }
  53.     public function setPermission(string $permission): self
  54.     {
  55.         $this->permission $permission;
  56.         return $this;
  57.     }
  58.     public function getUser(): ?User
  59.     {
  60.         return $this->user;
  61.     }
  62.     public function setUser(?User $user): self
  63.     {
  64.         $this->user $user;
  65.         return $this;
  66.     }
  67.     public function getWarehouse(): ?Warehouse
  68.     {
  69.         return $this->warehouse;
  70.     }
  71.     public function setWarehouse(?Warehouse $warehouse): self
  72.     {
  73.         $this->warehouse $warehouse;
  74.         return $this;
  75.     }
  76.     public function isMain(): ?bool
  77.     {
  78.         return $this->main;
  79.     }
  80.     public function setMain(bool $main): self
  81.     {
  82.         $this->main $main;
  83.         return $this;
  84.     }
  85. }