mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +02:00
start add selling
This commit is contained in:
parent
0d672d5447
commit
c1b2c97350
14 changed files with 1798 additions and 92 deletions
|
@ -11,6 +11,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use \App\Entity\GroupOfProducts;
|
||||
use \App\Entity\Product;
|
||||
use \App\Entity\Selling;
|
||||
|
||||
#[ApiResource(paginationEnabled: false)]
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
|
@ -65,11 +68,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
#[ORM\OneToMany(targetEntity: Product::class, mappedBy: 'user')]
|
||||
private Collection $products;
|
||||
|
||||
/**
|
||||
* @var Collection<int, GroupOfProducts>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'user')]
|
||||
private Collection $groupOfProducts;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Festival>
|
||||
|
@ -86,14 +84,27 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
|
||||
private ?Festival $activeFestival = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, GroupOfProducts>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'owner')]
|
||||
private Collection $groupOfProducts;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Selling>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Selling::class, mappedBy: 'owner')]
|
||||
private Collection $sellings;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->expenses = new ArrayCollection();
|
||||
$this->products = new ArrayCollection();
|
||||
$this->groupOfProducts = new ArrayCollection();
|
||||
$this->festivals = new ArrayCollection();
|
||||
$this->seriesFestival = new ArrayCollection();
|
||||
$this->groupOfProducts = new ArrayCollection();
|
||||
$this->sellings = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
|
@ -259,36 +270,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
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->setUser($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeGroupOfProduct(GroupOfProducts $groupOfProduct): static
|
||||
{
|
||||
if ($this->groupOfProducts->removeElement($groupOfProduct)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($groupOfProduct->getUser() === $this) {
|
||||
$groupOfProduct->setUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Festival>
|
||||
*/
|
||||
|
@ -387,4 +368,66 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||
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->setOwner($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeGroupOfProduct(GroupOfProducts $groupOfProduct): static
|
||||
{
|
||||
if ($this->groupOfProducts->removeElement($groupOfProduct)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($groupOfProduct->getOwner() === $this) {
|
||||
$groupOfProduct->setOwner(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Selling>
|
||||
*/
|
||||
public function getSellings(): Collection
|
||||
{
|
||||
return $this->sellings;
|
||||
}
|
||||
|
||||
public function addSelling(Selling $selling): static
|
||||
{
|
||||
if (!$this->sellings->contains($selling)) {
|
||||
$this->sellings->add($selling);
|
||||
$selling->setOwner($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSelling(Selling $selling): static
|
||||
{
|
||||
if ($this->sellings->removeElement($selling)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($selling->getOwner() === $this) {
|
||||
$selling->setOwner(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue