<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\MarqueRepository")
* @Vich\Uploadable
*/
class Marque
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $nom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $logo;
/**
* @Vich\UploadableField(mapping="marque_upload", fileNameProperty="logo")
* @var File
*/
private $logoFile;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $siteOfficiel;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Voiture", mappedBy="marque", orphanRemoval=true)
*/
private $voitures;
/**
* @var string
*
* @Gedmo\Slug(fields={"nom"})
* @ORM\Column(type="string", unique=true)
*/
private $slug;
public function __construct()
{
$this->voitures = new ArrayCollection();
}
public function getSlug():string
{
return $this->slug;
}
public function setSlug($slug): string
{
$this->slug = $slug;
return $this;
}
/**
* @param File|null $imageFile
*/
public function setImageFile(?File $imageFile = null)
{
$this->imageFile = $imageFile;
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getLogoFile()
{
return $this->logoFile;
}
public function setLogoFile(File $logoFile = null)
{
$this->logoFile = $logoFile;
return $this;
}
public function getSiteOfficiel(): ?string
{
return $this->siteOfficiel;
}
public function setSiteOfficiel(?string $siteOfficiel): self
{
$this->siteOfficiel = $siteOfficiel;
return $this;
}
/**
* @return Collection|Voiture[]
*/
public function getVoitures(): Collection
{
return $this->voitures;
}
public function addVoiture(Voiture $voiture): self
{
if (!$this->voitures->contains($voiture)) {
$this->voitures[] = $voiture;
$voiture->setMarque($this);
}
return $this;
}
public function removeVoiture(Voiture $voiture): self
{
if ($this->voitures->contains($voiture)) {
$this->voitures->removeElement($voiture);
// set the owning side to null (unless already changed)
if ($voiture->getMarque() === $this) {
$voiture->setMarque(null);
}
}
return $this;
}
public function __toString()
{
return $this->nom;
}
}