src/Entity/ShopUserAdress.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShopUserAdressRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ShopUserAdressRepository::class)
  9.  */
  10. class ShopUserAdress
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="shopUserAdresses")
  20.      * @ORM\JoinColumn(nullable=false)
  21.      */
  22.     private $user;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $adresse;
  27.     /**
  28.      * @ORM\Column(type="string", length=50)
  29.      */
  30.     private $code_postal;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $ville;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=ShopPanier::class, mappedBy="adress")
  37.      */
  38.     private $paniers;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=ShopOrder::class, mappedBy="adress")
  41.      */
  42.     private $commandes;
  43.     public function __construct()
  44.     {
  45.         $this->paniers = new ArrayCollection();
  46.         $this->commandes = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getUser(): ?User
  53.     {
  54.         return $this->user;
  55.     }
  56.     public function setUser(?User $user): self
  57.     {
  58.         $this->user $user;
  59.         return $this;
  60.     }
  61.     public function getAdresse(): ?string
  62.     {
  63.         return $this->adresse;
  64.     }
  65.     public function setAdresse(string $adresse): self
  66.     {
  67.         $this->adresse $adresse;
  68.         return $this;
  69.     }
  70.     public function getCodePostal(): ?string
  71.     {
  72.         return $this->code_postal;
  73.     }
  74.     public function setCodePostal(string $code_postal): self
  75.     {
  76.         $this->code_postal $code_postal;
  77.         return $this;
  78.     }
  79.     public function getVille(): ?string
  80.     {
  81.         return $this->ville;
  82.     }
  83.     public function setVille(string $ville): self
  84.     {
  85.         $this->ville $ville;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, ShopPanier>
  90.      */
  91.     public function getPaniers(): Collection
  92.     {
  93.         return $this->paniers;
  94.     }
  95.     public function addPanier(ShopPanier $panier): self
  96.     {
  97.         if (!$this->paniers->contains($panier)) {
  98.             $this->paniers[] = $panier;
  99.             $panier->setAdress($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removePanier(ShopPanier $panier): self
  104.     {
  105.         if ($this->paniers->removeElement($panier)) {
  106.             // set the owning side to null (unless already changed)
  107.             if ($panier->getAdress() === $this) {
  108.                 $panier->setAdress(null);
  109.             }
  110.         }
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, ShopOrder>
  115.      */
  116.     public function getCommandes(): Collection
  117.     {
  118.         return $this->commandes;
  119.     }
  120.     public function addCommande(ShopOrder $commande): self
  121.     {
  122.         if (!$this->commandes->contains($commande)) {
  123.             $this->commandes[] = $commande;
  124.             $commande->setAdress($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeCommande(ShopOrder $commande): self
  129.     {
  130.         if ($this->commandes->removeElement($commande)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($commande->getAdress() === $this) {
  133.                 $commande->setAdress(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138. }