src/Entity/Boutique.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BoutiqueRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassBoutiqueRepository::class)]
  8. class Boutique
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $nom null;
  16.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'boutiques')]
  17.     private ?self $boutiqueMere null;
  18.     #[ORM\OneToMany(mappedBy'boutiqueMere'targetEntityself::class)]
  19.     private Collection $boutiques;
  20.     #[ORM\OneToMany(mappedBy'boutique'targetEntityProduitStock::class)]
  21.     private Collection $produitStock;
  22.     #[ORM\OneToMany(mappedBy'boutique'targetEntitySortieStock::class)]
  23.     private Collection $sortieStocks;
  24.     #[ORM\OneToMany(mappedBy'boutique'targetEntityVente::class)]
  25.     private Collection $ventes;
  26.     #[ORM\OneToMany(mappedBy'boutique'targetEntityEntreeStock::class)]
  27.     private Collection $entreeStocks;
  28.     #[ORM\Column(nullabletrue)]
  29.     private ?bool $isMere null;
  30.     #[ORM\OneToMany(mappedBy'boutique'targetEntityUser::class)]
  31.     private Collection $users;
  32.     #[ORM\OneToMany(mappedBy'boutique'targetEntityRecette::class)]
  33.     private Collection $recettes;
  34.     #[ORM\OneToMany(mappedBy'boutique'targetEntityExercice::class)]
  35.     private Collection $exercices;
  36.     #[ORM\OneToMany(mappedBy'boutique'targetEntityEcritureComptable::class)]
  37.     private Collection $ecrituresComptables;
  38.     #[ORM\OneToMany(mappedBy'boutique'targetEntityCaisse::class, orphanRemovaltrue)]
  39.     private Collection $caisses;
  40.     public function __construct()
  41.     {
  42.         $this->boutiques = new ArrayCollection();
  43.         $this->produitStock = new ArrayCollection();
  44.         $this->sortieStocks = new ArrayCollection();
  45.         $this->ventes = new ArrayCollection();
  46.         $this->entreeStocks = new ArrayCollection();
  47.         $this->users = new ArrayCollection();
  48.         $this->recettes = new ArrayCollection();
  49.         $this->exercices = new ArrayCollection();
  50.         $this->ecrituresComptables = new ArrayCollection();
  51.         $this->caisses = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getNom(): ?string
  58.     {
  59.         return $this->nom;
  60.     }
  61.     public function setNom(string $nom): static
  62.     {
  63.         $this->nom $nom;
  64.         return $this;
  65.     }
  66.     public function getBoutiqueMere(): ?self
  67.     {
  68.         return $this->boutiqueMere;
  69.     }
  70.     public function setBoutiqueMere(?self $boutiqueMere): static
  71.     {
  72.         $this->boutiqueMere $boutiqueMere;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection<int, self>
  77.      */
  78.     public function getBoutiques(): Collection
  79.     {
  80.         return $this->boutiques;
  81.     }
  82.     public function addBoutique(self $boutique): static
  83.     {
  84.         if (!$this->boutiques->contains($boutique)) {
  85.             $this->boutiques->add($boutique);
  86.             $boutique->setBoutiqueMere($this);
  87.         }
  88.         return $this;
  89.     }
  90.     public function removeBoutique(self $boutique): static
  91.     {
  92.         if ($this->boutiques->removeElement($boutique)) {
  93.             // set the owning side to null (unless already changed)
  94.             if ($boutique->getBoutiqueMere() === $this) {
  95.                 $boutique->setBoutiqueMere(null);
  96.             }
  97.         }
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection<int, ProduitStock>
  102.      */
  103.     public function getProduitStock(): Collection
  104.     {
  105.         return $this->produitStock;
  106.     }
  107.     public function addProduitStock(ProduitStock $produitStock): static
  108.     {
  109.         if (!$this->produitStock->contains($produitStock)) {
  110.             $this->produitStock->add($produitStock);
  111.             $produitStock->setBoutique($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeProduitStock(ProduitStock $produitStock): static
  116.     {
  117.         if ($this->produitStock->removeElement($produitStock)) {
  118.             // set the owning side to null (unless already changed)
  119.             if ($produitStock->getBoutique() === $this) {
  120.                 $produitStock->setBoutique(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, SortieStock>
  127.      */
  128.     public function getSortieStocks(): Collection
  129.     {
  130.         return $this->sortieStocks;
  131.     }
  132.     public function addSortieStock(SortieStock $sortieStock): static
  133.     {
  134.         if (!$this->sortieStocks->contains($sortieStock)) {
  135.             $this->sortieStocks->add($sortieStock);
  136.             $sortieStock->setBoutique($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeSortieStock(SortieStock $sortieStock): static
  141.     {
  142.         if ($this->sortieStocks->removeElement($sortieStock)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($sortieStock->getBoutique() === $this) {
  145.                 $sortieStock->setBoutique(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, Vente>
  152.      */
  153.     public function getVentes(): Collection
  154.     {
  155.         return $this->ventes;
  156.     }
  157.     public function addVente(Vente $vente): static
  158.     {
  159.         if (!$this->ventes->contains($vente)) {
  160.             $this->ventes->add($vente);
  161.             $vente->setBoutique($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeVente(Vente $vente): static
  166.     {
  167.         if ($this->ventes->removeElement($vente)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($vente->getBoutique() === $this) {
  170.                 $vente->setBoutique(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return Collection<int, EntreeStock>
  177.      */
  178.     public function getEntreeStocks(): Collection
  179.     {
  180.         return $this->entreeStocks;
  181.     }
  182.     public function addEntreeStock(EntreeStock $entreeStock): static
  183.     {
  184.         if (!$this->entreeStocks->contains($entreeStock)) {
  185.             $this->entreeStocks->add($entreeStock);
  186.             $entreeStock->setBoutique($this);
  187.         }
  188.         return $this;
  189.     }
  190.     public function removeEntreeStock(EntreeStock $entreeStock): static
  191.     {
  192.         if ($this->entreeStocks->removeElement($entreeStock)) {
  193.             // set the owning side to null (unless already changed)
  194.             if ($entreeStock->getBoutique() === $this) {
  195.                 $entreeStock->setBoutique(null);
  196.             }
  197.         }
  198.         return $this;
  199.     }
  200.     public function isIsMere(): ?bool
  201.     {
  202.         return $this->isMere;
  203.     }
  204.     public function setIsMere(?bool $isMere): static
  205.     {
  206.         $this->isMere $isMere;
  207.         return $this;
  208.     }
  209.     /**
  210.      * @return Collection<int, User>
  211.      */
  212.     public function getUsers(): Collection
  213.     {
  214.         return $this->users;
  215.     }
  216.     public function addUser(User $user): static
  217.     {
  218.         if (!$this->users->contains($user)) {
  219.             $this->users->add($user);
  220.             $user->setBoutique($this);
  221.         }
  222.         return $this;
  223.     }
  224.     public function removeUser(User $user): static
  225.     {
  226.         if ($this->users->removeElement($user)) {
  227.             // set the owning side to null (unless already changed)
  228.             if ($user->getBoutique() === $this) {
  229.                 $user->setBoutique(null);
  230.             }
  231.         }
  232.         return $this;
  233.     }
  234.     /**
  235.      * @return Collection<int, Recette>
  236.      */
  237.     public function getRecettes(): Collection
  238.     {
  239.         return $this->recettes;
  240.     }
  241.     public function addRecette(Recette $recette): static
  242.     {
  243.         if (!$this->recettes->contains($recette)) {
  244.             $this->recettes->add($recette);
  245.             $recette->setBoutique($this);
  246.         }
  247.         return $this;
  248.     }
  249.     public function removeRecette(Recette $recette): static
  250.     {
  251.         if ($this->recettes->removeElement($recette)) {
  252.             // set the owning side to null (unless already changed)
  253.             if ($recette->getBoutique() === $this) {
  254.                 $recette->setBoutique(null);
  255.             }
  256.         }
  257.         return $this;
  258.     }
  259.     /**
  260.      * @return Collection<int, Exercice>
  261.      */
  262.     public function getExercices(): Collection
  263.     {
  264.         return $this->exercices;
  265.     }
  266.     public function addExercice(Exercice $exercice): static
  267.     {
  268.         if (!$this->exercices->contains($exercice)) {
  269.             $this->exercices->add($exercice);
  270.             $exercice->setBoutique($this);
  271.         }
  272.         return $this;
  273.     }
  274.     public function removeExercice(Exercice $exercice): static
  275.     {
  276.         if ($this->exercices->removeElement($exercice)) {
  277.             if ($exercice->getBoutique() === $this) {
  278.                 $exercice->setBoutique(null);
  279.             }
  280.         }
  281.         return $this;
  282.     }
  283.     /**
  284.      * @return Collection<int, EcritureComptable>
  285.      */
  286.     public function getEcrituresComptables(): Collection
  287.     {
  288.         return $this->ecrituresComptables;
  289.     }
  290.     public function addEcritureComptable(EcritureComptable $ecritureComptable): static
  291.     {
  292.         if (!$this->ecrituresComptables->contains($ecritureComptable)) {
  293.             $this->ecrituresComptables->add($ecritureComptable);
  294.             $ecritureComptable->setBoutique($this);
  295.         }
  296.         return $this;
  297.     }
  298.     public function removeEcritureComptable(EcritureComptable $ecritureComptable): static
  299.     {
  300.         if ($this->ecrituresComptables->removeElement($ecritureComptable)) {
  301.             if ($ecritureComptable->getBoutique() === $this) {
  302.                 $ecritureComptable->setBoutique(null);
  303.             }
  304.         }
  305.         return $this;
  306.     }
  307.     /**
  308.      * @return Collection<int, Caisse>
  309.      */
  310.     public function getCaisses(): Collection
  311.     {
  312.         return $this->caisses;
  313.     }
  314.     public function addCaisse(Caisse $caisse): static
  315.     {
  316.         if (!$this->caisses->contains($caisse)) {
  317.             $this->caisses->add($caisse);
  318.             $caisse->setBoutique($this);
  319.         }
  320.         return $this;
  321.     }
  322.     public function removeCaisse(Caisse $caisse): static
  323.     {
  324.         if ($this->caisses->removeElement($caisse)) {
  325.             if ($caisse->getBoutique() === $this) {
  326.                 $caisse->setBoutique(null);
  327.             }
  328.         }
  329.         return $this;
  330.     }
  331.     public function getCaisseOuverte(): ?Caisse
  332.     {
  333.         foreach ($this->caisses as $caisse) {
  334.             if ($caisse->isOuverte()) {
  335.                 return $caisse;
  336.             }
  337.         }
  338.         return null;
  339.     }
  340. }