<?php
namespace App\Entity;
use App\Repository\EvenementAVenirRepository;
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 ApiPlatform\Core\Annotation\ApiResource;
/**
* @ORM\Entity(repositoryClass=EvenementAVenirRepository::class)
*/
/**
* @ApiResource
* @ORM\Entity
* @Vich\Uploadable
*/
class EvenementAVenir
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=200)
*/
private $titre;
/**
* @ORM\Column(type="string", length=200)
*/
private $category;
/**
* @ORM\Column(type="boolean")
*/
private $desplay;
/**
* @ORM\Column(type="text")
*/
private $Description;
/**
* @ORM\Column(type="string", length=255)
*/
private $imagePrincipale;
/**
* @Vich\UploadableField(mapping="evenement_images_avenir", fileNameProperty="imagePrincipale")
* @var File
*/
private $imageFile;
/**
* @ORM\Column(type="date")
*/
private $DateEvenement;
/**
* @ORM\OneToMany(targetEntity="Attachment",mappedBy="evenement",cascade={"remove","persist"})
*/
private $attachments;
/**
* @ORM\OneToMany(targetEntity="PrixVariable",mappedBy="evenementprix",cascade={"remove","persist"})
*/
private $prixvariables;
/**
* @ORM\ManyToOne(targetEntity="Event",inversedBy="newevenement")
*/
private $evenementevent;
/**
* @ORM\OneToMany(targetEntity="PayementMethod",mappedBy="evenementautre",cascade={"remove","persist"})
*/
private $evenementIdAutre;
/**
* @ORM\OneToMany(targetEntity="Document",mappedBy="documentautre",cascade={"remove","persist"})
*/
private $evenementDocumentAutre;
public function __construct()
{
$this->attachments = new ArrayCollection();
$this->prixvariables = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getCategory(): ?string
{
return $this->category;
}
public function setCategory(string $category): self
{
$this->category = $category;
return $this;
}
public function getDescription(): ?string
{
return $this->Description;
}
public function setDescription(string $Description): self
{
$this->Description = $Description;
return $this;
}
public function getImagePrincipale(): ?string
{
return $this->imagePrincipale;
}
public function setImagePrincipale(string $imagePrincipale): self
{
$this->imagePrincipale = $imagePrincipale;
return $this;
}
public function getDateEvenement(): ?\DateTimeInterface
{
return $this->DateEvenement;
}
public function setDateEvenement(\DateTimeInterface $DateEvenement): self
{
$this->DateEvenement = $DateEvenement;
return $this;
}
/******* settter et getter des images ****/
public function setImageFile(File $image = null)
{
$this->imageFile = $image;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($image) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getImageFile()
{
return $this->imageFile;
}
/**
* @return Collection|Attachment[]
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(Attachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments[] = $attachment;
$attachment->setEvenement($this);
}
return $this;
}
public function removeAttachment(Attachment $attachment): self
{
if ($this->attachments->removeElement($attachment)) {
// set the owning side to null (unless already changed)
if ($attachment->getEvenement() === $this) {
$attachment->setEvenement(null);
}
}
return $this;
}
/**
* @return Collection|PrixVariable[]
*/
public function getPrixvariables(): Collection
{
return $this->prixvariables;
}
public function addPrixvariable(PrixVariable $prixvariable): self
{
if (!$this->prixvariables->contains($prixvariable)) {
$this->prixvariables[] = $prixvariable;
$prixvariable->setEvenementprix($this);
}
return $this;
}
public function removePrixvariable(PrixVariable $prixvariable): self
{
if ($this->prixvariables->removeElement($prixvariable)) {
// set the owning side to null (unless already changed)
if ($prixvariable->getEvenementprix() === $this) {
$prixvariable->setEvenementprix(null);
}
}
return $this;
}
public function getDesplay(): ?bool
{
return $this->desplay;
}
public function setDesplay(bool $desplay): self
{
$this->desplay = $desplay;
return $this;
}
public function getEvenementevent(): ?Event
{
return $this->evenementevent;
}
public function setEvenementevent(?Event $evenementevent): self
{
$this->evenementevent = $evenementevent;
return $this;
}
public function __toString(): string
{
return $this->titre;
}
}