caisse-bliss/src/Entity/Selling.php

142 lines
3 KiB
PHP
Raw Normal View History

2025-02-09 16:05:39 +01:00
<?php
namespace App\Entity;
use App\Repository\SellingRepository;
2025-02-14 11:00:20 +01:00
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
2025-02-09 16:05:39 +01:00
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;
2025-02-14 11:00:20 +01:00
/**
* @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;
2025-02-14 11:00:20 +01:00
public function __construct()
{
$this->groupOfProducts = new ArrayCollection();
$this->products = new ArrayCollection();
2025-02-14 11:00:20 +01:00
}
2025-02-09 16:05:39 +01:00
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;
}
2025-02-14 11:00:20 +01:00
/**
* @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;
}
2025-02-09 16:05:39 +01:00
}