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
|
@ -55,6 +55,12 @@ class Festival
|
|||
#[ORM\ManyToOne(inversedBy: 'festivals')]
|
||||
private ?SerieFestival $serieFestival = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?float $chiffreAffaire = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $clientsCount = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->users = new ArrayCollection();
|
||||
|
@ -233,4 +239,28 @@ class Festival
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChiffreAffaire(): ?float
|
||||
{
|
||||
return $this->chiffreAffaire;
|
||||
}
|
||||
|
||||
public function setChiffreAffaire(?float $chiffreAffaire): static
|
||||
{
|
||||
$this->chiffreAffaire = $chiffreAffaire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClientsCount(): ?int
|
||||
{
|
||||
return $this->clientsCount;
|
||||
}
|
||||
|
||||
public function setClientsCount(?int $clientsCount): static
|
||||
{
|
||||
$this->clientsCount = $clientsCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
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;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use \App\Entity\GroupOfProducts;
|
||||
use \App\Entity\Product;
|
||||
use \App\Entity\Selling;
|
||||
|
||||
#[ApiResource(paginationEnabled: false)]
|
||||
#[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)]
|
||||
|
@ -24,7 +26,6 @@ class GroupOfProducts
|
|||
/**
|
||||
* @var Collection<int, Product>
|
||||
*/
|
||||
// TODO apiresource return properties
|
||||
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')]
|
||||
private Collection $products;
|
||||
|
||||
|
@ -35,7 +36,8 @@ class GroupOfProducts
|
|||
private ?Collection $sellings = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'groupOfProducts')]
|
||||
private ?User $user = null;
|
||||
private ?User $owner = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -72,10 +74,11 @@ class GroupOfProducts
|
|||
}
|
||||
return $productsDTO;
|
||||
}
|
||||
public function getProducts(): ?object
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function getProducts(): ?object
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function setProducts(object $products): static
|
||||
{
|
||||
|
@ -124,14 +127,14 @@ class GroupOfProducts
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getUser(): ?User
|
||||
public function getOwner(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setUser(?User $user): static
|
||||
public function setOwner(?User $owner): static
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->owner = $owner;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SellingRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource(paginationEnabled: false)]
|
||||
#[ORM\Entity(repositoryClass: SellingRepository::class)]
|
||||
|
@ -42,6 +40,16 @@ class Selling
|
|||
#[ORM\ManyToOne(inversedBy: 'sellings')]
|
||||
private ?Festival $festival = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $customer_info = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?float $paidByCustomer = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'sellings')]
|
||||
private ?User $owner = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->groupOfProducts = new ArrayCollection();
|
||||
|
@ -155,4 +163,42 @@ class Selling
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerInfo(): ?string
|
||||
{
|
||||
return $this->customer_info;
|
||||
}
|
||||
|
||||
public function setCustomerInfo(string $customer_info): static
|
||||
{
|
||||
$this->customer_info = $customer_info;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPaidByCustomer(): ?float
|
||||
{
|
||||
return $this->paidByCustomer;
|
||||
}
|
||||
|
||||
public function setPaidByCustomer(float $paidByCustomer): static
|
||||
{
|
||||
$this->paidByCustomer = $paidByCustomer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwner(): ?User
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setOwner(?User $owner): static
|
||||
{
|
||||
$this->owner = $owner;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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