<?php
namespace App\Entity;
use App\Repository\FreelanceStockRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FreelanceStockRepository::class)
* @ORM\Table(
* name="freelance_stock",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="unique_freelance_product", columns={"freelance_id", "produit_id"})
* }
* )
*/
class FreelanceStock
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* Freelance connecté (UserPlatform)
*
* @ORM\ManyToOne(targetEntity=UserPlatform::class)
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $freelance;
/**
* Produit concerné
*
* @ORM\ManyToOne(targetEntity=Product::class, inversedBy="freelanceStocks")
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private $produit;
/**
* @ORM\Column(type="integer")
*/
private $stock = 0;
public function getId(): ?int
{
return $this->id;
}
public function getFreelance(): ?UserPlatform
{
return $this->freelance;
}
public function setFreelance(?UserPlatform $freelance): self
{
$this->freelance = $freelance;
return $this;
}
public function getProduit(): ?Product
{
return $this->produit;
}
public function setProduit(?Product $produit): self
{
$this->produit = $produit;
return $this;
}
public function getStock(): ?int
{
return $this->stock;
}
public function setStock(int $stock): self
{
$this->stock = $stock;
return $this;
}
}