<?phpnamespace App\Entity;use App\Repository\ShopUserAdressRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ShopUserAdressRepository::class) */class ShopUserAdress{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="shopUserAdresses") * @ORM\JoinColumn(nullable=false) */ private $user; /** * @ORM\Column(type="string", length=255) */ private $adresse; /** * @ORM\Column(type="string", length=50) */ private $code_postal; /** * @ORM\Column(type="string", length=255) */ private $ville; /** * @ORM\OneToMany(targetEntity=ShopPanier::class, mappedBy="adress") */ private $paniers; /** * @ORM\OneToMany(targetEntity=ShopOrder::class, mappedBy="adress") */ private $commandes; public function __construct() { $this->paniers = new ArrayCollection(); $this->commandes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getAdresse(): ?string { return $this->adresse; } public function setAdresse(string $adresse): self { $this->adresse = $adresse; return $this; } public function getCodePostal(): ?string { return $this->code_postal; } public function setCodePostal(string $code_postal): self { $this->code_postal = $code_postal; return $this; } public function getVille(): ?string { return $this->ville; } public function setVille(string $ville): self { $this->ville = $ville; return $this; } /** * @return Collection<int, ShopPanier> */ public function getPaniers(): Collection { return $this->paniers; } public function addPanier(ShopPanier $panier): self { if (!$this->paniers->contains($panier)) { $this->paniers[] = $panier; $panier->setAdress($this); } return $this; } public function removePanier(ShopPanier $panier): self { if ($this->paniers->removeElement($panier)) { // set the owning side to null (unless already changed) if ($panier->getAdress() === $this) { $panier->setAdress(null); } } return $this; } /** * @return Collection<int, ShopOrder> */ public function getCommandes(): Collection { return $this->commandes; } public function addCommande(ShopOrder $commande): self { if (!$this->commandes->contains($commande)) { $this->commandes[] = $commande; $commande->setAdress($this); } return $this; } public function removeCommande(ShopOrder $commande): self { if ($this->commandes->removeElement($commande)) { // set the owning side to null (unless already changed) if ($commande->getAdress() === $this) { $commande->setAdress(null); } } return $this; }}