<?php
namespace App\Entity\VenteRechercheMagasins;
use App\Entity\Adherent\Magasin;
use App\Entity\Departement;
use App\Entity\Region;
use App\Repository\VenteRechercheMagasins\VenteRechercheMagasinsAlertesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VenteRechercheMagasinsAlertesRepository::class)]
class VenteRechercheMagasinsAlertes
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: Magasin::class, inversedBy: 'venteRechercheMagasinsAlertes')]
#[ORM\JoinColumn(name: 'magasin_id', referencedColumnName: 'k_adherent', nullable: false)]
private ?Magasin $magasin = null;
// #[ORM\ManyToOne(targetEntity: Magasin::class, inversedBy: 'venteRechercheMagasinsAlertes')]
// #[ORM\JoinColumn(referencedColumnName: "code", nullable: false)]
// private ?Departement $departement = null;
#[ORM\Column(length: 255)]
private ?string $type = null;
#[ORM\InverseJoinColumn(name: 'code', referencedColumnName: 'code')]
#[ORM\ManyToMany(targetEntity: Departement::class, inversedBy: 'venteRechercheAlertes')]
private Collection $departements;
#[ORM\ManyToMany(targetEntity: Region::class, inversedBy: 'venteRechercheMagasinsAlertes')]
private Collection $region;
public function __construct()
{
$this->departements = new ArrayCollection();
$this->region = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getMagasin(): ?Magasin
{
return $this->magasin;
}
public function setMagasin(?Magasin $magasin): static
{
$this->magasin = $magasin;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, Departement>
*/
public function getDepartements(): Collection
{
return $this->departements;
}
public function addDepartements(Departement $departements): static
{
if (!$this->departements->contains($departements)) {
$this->departements->add($departements);
}
return $this;
}
public function removeDepartements(Departement $departements): static
{
$this->departements->removeElement($departements);
return $this;
}
/**
* @return Collection<int, Region>
*/
public function getRegion(): Collection
{
return $this->region;
}
public function addRegion(Region $region): static
{
if (!$this->region->contains($region)) {
$this->region->add($region);
}
return $this;
}
public function removeRegion(Region $region): static
{
$this->region->removeElement($region);
return $this;
}
}