mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +02:00
up schema with relations between objects
This commit is contained in:
parent
1c700917b3
commit
17e7fce7f8
8 changed files with 433 additions and 11 deletions
|
@ -19,9 +19,6 @@ class Selling
|
|||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $note = null;
|
||||
|
||||
#[ORM\Column(type: Types::OBJECT)]
|
||||
private ?object $products = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $sum = null;
|
||||
|
||||
|
@ -34,9 +31,16 @@ class Selling
|
|||
#[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
|
||||
|
@ -118,4 +122,20 @@ class Selling
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue