<?php
namespace App\Entity;
use App\Repository\ContinentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=ContinentRepository::class)
*/
class Continent
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* Slug immuable et unique (ex: "st-lucie")
* @Gedmo\Slug(fields={"name"}, updatable=true, unique=true)
* @ORM\Column(type="string", length=180, unique=true)
*/
private $slug;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $img;
/**
* @ORM\OneToMany(targetEntity=Offer::class, mappedBy="continent")
*/
private $offers;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $subtitle;
public function __construct()
{
$this->offers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getImg(): ?string
{
return $this->img;
}
public function setImg(?string $img): self
{
$this->img = $img;
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->setContinent($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
// set the owning side to null (unless already changed)
if ($offer->getContinent() === $this) {
$offer->setContinent(null);
}
}
return $this;
}
/**
* Get slug immuable et unique (ex: "st-lucie")
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set slug immuable et unique (ex: "st-lucie")
*
* @return self
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
}