mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +02:00
groupes de rendu api contre la dépendance circulaire dans groupeofproducts
This commit is contained in:
parent
c1b2c97350
commit
19cdb12d28
2 changed files with 8 additions and 3 deletions
|
@ -10,6 +10,8 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
use \App\Entity\GroupOfProducts;
|
use \App\Entity\GroupOfProducts;
|
||||||
use \App\Entity\Product;
|
use \App\Entity\Product;
|
||||||
use \App\Entity\Selling;
|
use \App\Entity\Selling;
|
||||||
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
#[ApiResource(paginationEnabled: false)]
|
#[ApiResource(paginationEnabled: false)]
|
||||||
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
||||||
|
@ -21,12 +23,14 @@ class GroupOfProducts
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
|
#[Groups(['default'])]
|
||||||
private ?string $name = null;
|
private ?string $name = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Product>
|
* @var Collection<int, Product>
|
||||||
*/
|
*/
|
||||||
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')]
|
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')]
|
||||||
|
#[Groups(['default'])]
|
||||||
private Collection $products;
|
private Collection $products;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +79,8 @@ class GroupOfProducts
|
||||||
return $productsDTO;
|
return $productsDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProducts(): ?object
|
#[Groups(['default'])]
|
||||||
|
public function getProducts(): Collection
|
||||||
{
|
{
|
||||||
return $this->products;
|
return $this->products;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ class Product
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
#[Groups(['default', 'relation'])]
|
#[Groups(['default'])]
|
||||||
private ?string $name = null;
|
private ?string $name = null;
|
||||||
|
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
#[Groups(['default', 'relation'])]
|
#[Groups(['default'])]
|
||||||
private ?float $price = null;
|
private ?float $price = null;
|
||||||
|
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue