src/Entity/FreelanceStock.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FreelanceStockRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=FreelanceStockRepository::class)
  7.  * @ORM\Table(
  8.  *     name="freelance_stock",
  9.  *     uniqueConstraints={
  10.  *         @ORM\UniqueConstraint(name="unique_freelance_product", columns={"freelance_id", "produit_id"})
  11.  *     }
  12.  * )
  13.  */
  14. class FreelanceStock
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * Freelance connecté (UserPlatform)
  24.      * 
  25.      * @ORM\ManyToOne(targetEntity=UserPlatform::class)
  26.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  27.      */
  28.     private $freelance;
  29.     /**
  30.      * Produit concerné
  31.      * 
  32.      * @ORM\ManyToOne(targetEntity=Product::class, inversedBy="freelanceStocks")
  33.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  34.      */
  35.     private $produit;
  36.     /**
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $stock = 0;
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getFreelance(): ?UserPlatform
  45.     {
  46.         return $this->freelance;
  47.     }
  48.     public function setFreelance(?UserPlatform $freelance): self
  49.     {
  50.         $this->freelance = $freelance;
  51.         return $this;
  52.     }
  53.     public function getProduit(): ?Product
  54.     {
  55.         return $this->produit;
  56.     }
  57.     public function setProduit(?Product $produit): self
  58.     {
  59.         $this->produit = $produit;
  60.         return $this;
  61.     }
  62.     public function getStock(): ?int
  63.     {
  64.         return $this->stock;
  65.     }
  66.     public function setStock(int $stock): self
  67.     {
  68.         $this->stock = $stock;
  69.         return $this;
  70.     }
  71. }