caisse-bliss/src/Entity/Selling.php
2025-02-14 11:08:34 +01:00

141 lines
3 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\SellingRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SellingRepository::class)]
class Selling
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $note = null;
#[ORM\Column]
private ?float $sum = null;
#[ORM\Column(nullable: true)]
private ?float $reduction = null;
/**
* @var Collection<int, GroupOfProducts>
*/
#[ORM\ManyToMany(targetEntity: GroupOfProducts::class, mappedBy: 'sellings')]
private Collection $groupOfProducts;
/**
* @var Collection<int, Product>
*/
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'sellings')]
private Collection $products;
public function __construct()
{
$this->groupOfProducts = new ArrayCollection();
$this->products = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): static
{
$this->note = $note;
return $this;
}
public function getProducts(): ?object
{
return $this->products;
}
public function setProducts(object $products): static
{
$this->products = $products;
return $this;
}
public function getSum(): ?float
{
return $this->sum;
}
public function setSum(float $sum): static
{
$this->sum = $sum;
return $this;
}
public function getReduction(): ?float
{
return $this->reduction;
}
public function setReduction(?float $reduction): static
{
$this->reduction = $reduction;
return $this;
}
/**
* @return Collection<int, GroupOfProducts>
*/
public function getGroupOfProducts(): Collection
{
return $this->groupOfProducts;
}
public function addGroupOfProduct(GroupOfProducts $groupOfProduct): static
{
if (!$this->groupOfProducts->contains($groupOfProduct)) {
$this->groupOfProducts->add($groupOfProduct);
$groupOfProduct->addSelling($this);
}
return $this;
}
public function removeGroupOfProduct(GroupOfProducts $groupOfProduct): static
{
if ($this->groupOfProducts->removeElement($groupOfProduct)) {
$groupOfProduct->removeSelling($this);
}
return $this;
}
public function addProduct(Product $product): static
{
if (!$this->products->contains($product)) {
$this->products->add($product);
}
return $this;
}
public function removeProduct(Product $product): static
{
$this->products->removeElement($product);
return $this;
}
}