mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-10-09 17:02:47 +02:00
up
This commit is contained in:
parent
347e08358c
commit
6df4488b5c
39 changed files with 1462 additions and 6 deletions
78
src/Entity/GroupOfProducts.php
Normal file
78
src/Entity/GroupOfProducts.php
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\GroupOfProductsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
||||
class GroupOfProducts
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $name = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Product>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')]
|
||||
private Collection $products;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->products = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProducts(): ?object
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function setProducts(object $products): static
|
||||
{
|
||||
$this->products = $products;
|
||||
|
||||
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