src/Entity/Evenement.php line 12
<?php
namespace App\Entity;
use App\Repository\EvenementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EvenementRepository::class)]
class Evenement
{
const STATUS_DRAFT = 1;
const STATUS_VALIDATED = 2;
const STATUS_DISABLED = 3;
const STATUS_ARCHIVED = 4;
const COMMUNICATION_ORALE = 1;
const COMMUNICATION_ECRITE = 2;
const POSTER = 3;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $titleFormatted = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $subTitle = null;
#[ORM\Column(type: Types::SMALLINT)]
private ?int $status = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $startDate = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $endDate = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'subEvenements')]
#[ORM\JoinColumn(nullable: true)]
private ?self $parent = null;
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
private Collection $subEvenements;
#[ORM\Column(type: Types::JSON, nullable: true)]
private ?array $settings = [];
#[ORM\OneToMany(mappedBy: 'evenement', targetEntity: Line::class)]
private Collection $lineList;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updatedAt;
#[ORM\OneToMany(mappedBy: 'evenement', targetEntity: Inscription::class)]
private Collection $inscriptions;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $dateOfPublication = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $dateEndOfPublication = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateDebutSoumission = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateFinSoumission = null;
#[ORM\Column]
private ?bool $inscription = false;
#[ORM\Column]
private ?bool $soumissionAbstract = false;
#[ORM\Column(type: Types::BOOLEAN, nullable: true, options: ['default' => false])]
private ?bool $soumissionAbstractMultiThemes = false;
#[ORM\Column(length: 255, nullable: true)]
private ?string $couverture = null;
#[ORM\Column(length: 50)]
private ?string $lieu = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $seoAlias = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $seoTitle = null;
#[ORM\Column(length: 1000, nullable: true)]
private ?string $seoKeywords = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $seoDescription = null;
#[ORM\Column(length: 255)]
private ?string $reference = null;
#[ORM\Column(name: "programme_url", nullable: true)]
private ?string $programmeUrl = null;
#[ORM\Column(name: "payment_success_text", nullable: true)]
private ?string $paymentSuccessText = null;
#[ORM\Column(name: "payment_failure_text", nullable: true)]
private ?string $paymentFailureText = null;
#[ORM\Column(nullable: true)]
private ?int $estCongres = null;
#[ORM\Column(nullable: true)]
private ?int $estArchive = null;
#[ORM\Column(nullable: true, options: [])] // 'default' => "[]"
private ?array $compteurs = [];
#[ORM\OneToMany(mappedBy: 'eventId', targetEntity: EventAbstract::class)]
private Collection $eventAbstracts;
#[ORM\OneToMany(mappedBy: 'event', targetEntity: Participant::class)]
private Collection $participants;
#[ORM\Column(type: Types::BOOLEAN, nullable: true, options: ['default' => false])]
private bool $isMembership = false;
#[ORM\Column(type: Types::INTEGER, nullable: true)]
private ?int $membershipYear = null;
#[ORM\Column(nullable: true, options: [])] // 'default' => "[]"
private ?array $paymentMethodes = [];
public function __construct()
{
$this->subEvenements = new ArrayCollection();
$this->lineList = new ArrayCollection();
$this->inscriptions = new ArrayCollection();
$this->eventAbstracts = new ArrayCollection();
$this->compteurs = [
"1" => 0,
"2" => 0,
"3" => 0,
"4" => 0,
];
$this->paymentMethodes = [];
$this->participants = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function getTitleForAttestation()
{
return $this->title ? str_ireplace(["Inscription aux ateliers - ", "Inscription au "], "", $this->title) : null;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
public function getStartDate(): ?\DateTimeInterface
{
return $this->startDate;
}
public function setStartDate(\DateTimeInterface $startDate): self
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(\DateTimeInterface $endDate): self
{
$this->endDate = $endDate;
return $this;
}
/**
* @return Collection<int, Line>
*/
public function getLineList(): Collection
{
return $this->lineList;
}
public function addLineList(Line $lineList): self
{
if (!$this->lineList->contains($lineList)) {
$this->lineList->add($lineList);
$lineList->setEvenement($this);
}
return $this;
}
public function removeLineList(Line $lineList): self
{
if ($this->lineList->removeElement($lineList)) {
// set the owning side to null (unless already changed)
if ($lineList->getEvenement() === $this) {
$lineList->setEvenement(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection<int, Inscription>
*/
public function getInscriptions(): Collection
{
return $this->inscriptions;
}
public function addInscription(Inscription $inscription): self
{
if (!$this->inscriptions->contains($inscription)) {
$this->inscriptions->add($inscription);
$inscription->setEvenement($this);
}
return $this;
}
public function removeInscription(Inscription $inscription): self
{
if ($this->inscriptions->removeElement($inscription)) {
// set the owning side to null (unless already changed)
if ($inscription->getEvenement() === $this) {
$inscription->setEvenement(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDateOfPublication(): ?\DateTimeInterface
{
return $this->dateOfPublication;
}
public function setDateOfPublication(\DateTimeInterface $dateOfPublication): self
{
$this->dateOfPublication = $dateOfPublication;
return $this;
}
public function getDateEndOfPublication(): ?\DateTimeInterface
{
return $this->dateEndOfPublication;
}
public function setDateEndOfPublication(\DateTimeInterface $dateEndOfPublication): self
{
$this->dateEndOfPublication = $dateEndOfPublication;
return $this;
}
public function isInscription(): ?bool
{
return $this->inscription;
}
public function setInscription(bool $inscription): self
{
$this->inscription = $inscription;
return $this;
}
public function isSoumissionAbstract(): ?bool
{
return $this->soumissionAbstract;
}
public function setSoumissionAbstract(bool $soumissionAbstract): self
{
$this->soumissionAbstract = $soumissionAbstract;
return $this;
}
public function getCouverture(): ?string
{
return $this->couverture;
}
public function setCouverture(?string $couverture): self
{
$this->couverture = $couverture;
return $this;
}
public function getLieu(): ?string
{
return $this->lieu;
}
public function setLieu(string $lieu): self
{
$this->lieu = $lieu;
return $this;
}
public function getSeoAlias(): ?string
{
return $this->seoAlias;
}
public function setSeoAlias(?string $seoAlias): self
{
$this->seoAlias = $seoAlias;
return $this;
}
public function getSeoTitle(): ?string
{
return $this->seoTitle;
}
public function setSeoTitle(?string $seoTitle): self
{
$this->seoTitle = $seoTitle;
return $this;
}
public function getSeoKeywords(): ?string
{
return $this->seoKeywords;
}
public function setSeoKeywords(?string $seoKeywords): self
{
$this->seoKeywords = $seoKeywords;
return $this;
}
public function getSeoDescription(): ?string
{
return $this->seoDescription;
}
public function setSeoDescription(?string $seoDescription): self
{
$this->seoDescription = $seoDescription;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
/**
* Get the value of titleFormatted
*/
public function getTitleFormatted()
{
if ($this->titleFormatted) {
return $this->titleFormatted;
}
return $this->getTitle();
}
/**
* Set the value of titleFormatted
*
* @return self
*/
public function setTitleFormatted($titleFormatted)
{
$this->titleFormatted = $titleFormatted;
return $this;
}
/**
* Get the value of programmeUrl
*/
public function getProgrammeUrl()
{
return $this->programmeUrl;
}
/**
* Set the value of programmeUrl
*
* @return self
*/
public function setProgrammeUrl($programmeUrl)
{
$this->programmeUrl = $programmeUrl;
return $this;
}
/**
* Get the value of paymentSuccessText
*/
public function getPaymentSuccessText()
{
return $this->paymentSuccessText;
}
/**
* Set the value of paymentSuccessText
*
* @return self
*/
public function setPaymentSuccessText($paymentSuccessText)
{
$this->paymentSuccessText = $paymentSuccessText;
return $this;
}
/**
* Get the value of paymentFailureText
*/
public function getPaymentFailureText()
{
return $this->paymentFailureText;
}
/**
* Set the value of paymentFailureText
*
* @return self
*/
public function setPaymentFailureText($paymentFailureText)
{
$this->paymentFailureText = $paymentFailureText;
return $this;
}
public function getEstCongres(): ?int
{
return $this->estCongres;
}
public function setEstCongres(?int $estCongres): static
{
$this->estCongres = $estCongres;
return $this;
}
public function getEstArchive(): ?int
{
return $this->estArchive;
}
public function setEstArchive(?int $estArchive): static
{
$this->estArchive = $estArchive;
return $this;
}
public function getCompteurs(): ?array
{
if (is_null($this->compteurs)) {
$this->compteurs = [];
}
return $this->compteurs;
}
public function setCompteurs(?array $compteurs): static
{
$this->compteurs = $compteurs;
return $this;
}
/**
* @return Collection<int, EventAbstract>
*/
public function getEventAbstracts(): Collection
{
return $this->eventAbstracts;
}
public function addEventAbstract(EventAbstract $eventAbstract): static
{
if (!$this->eventAbstracts->contains($eventAbstract)) {
$this->eventAbstracts->add($eventAbstract);
$eventAbstract->setEvenement($this);
}
return $this;
}
public function removeEventAbstract(EventAbstract $eventAbstract): static
{
if ($this->eventAbstracts->removeElement($eventAbstract)) {
// set the owning side to null (unless already changed)
if ($eventAbstract->getEvenement() === $this) {
$eventAbstract->setEvenement(null);
}
}
return $this;
}
/**
* Cette fonction sert à mettre à jour les compteurs des types d'abstracts
*
* @param int $type type d'abstract dont on va mettre à jour le compteur
* @param int $newOcc nouvelle valeur du compteur
* @return void
*/
public function modifyCompteurs($type, $newOcc)
{
if ($type && !is_null($newOcc)) {
$str = strval($type);
$this->compteurs[$str] = $newOcc;
}
}
/**
* @return Collection<int, Participant>
*/
public function getParticipants(): Collection
{
return $this->participants;
}
public function addParticipant(Participant $participant): static
{
if (!$this->participants->contains($participant)) {
$this->participants->add($participant);
$participant->setEvent($this);
}
return $this;
}
public function removeParticipant(Participant $participant): static
{
if ($this->participants->removeElement($participant)) {
// set the owning side to null (unless already changed)
if ($participant->getEvent() === $this) {
$participant->setEvent(null);
}
}
return $this;
}
public function getDateDebutSoumission(): ?\DateTimeInterface
{
return $this->dateDebutSoumission;
}
public function setDateDebutSoumission(?\DateTimeInterface $dateDebutSoumission): static
{
$this->dateDebutSoumission = $dateDebutSoumission;
return $this;
}
public function getDateFinSoumission(): ?\DateTimeInterface
{
return $this->dateFinSoumission;
}
public function setDateFinSoumission(?\DateTimeInterface $dateFinSoumission): static
{
$this->dateFinSoumission = $dateFinSoumission;
return $this;
}
public function isMembership()
{
return $this->isMembership;
}
public function getIsMembership()
{
return $this->isMembership();
}
public function setIsMembership($isMembership)
{
$this->isMembership = $isMembership;
return $this;
}
public function getMembershipYear()
{
return $this->membershipYear;
}
public function setMembershipYear($membershipYear)
{
$this->membershipYear = $membershipYear;
return $this;
}
public function getPaymentMethodes(): ?array
{
if (is_null($this->paymentMethodes)) {
$this->paymentMethodes = [];
}
return $this->paymentMethodes;
}
public function setPaymentMethodes(?array $paymentMethodes): self
{
$this->paymentMethodes = $paymentMethodes;
return $this;
}
public function isSoumissionAbstractMultiThemes(): ?bool
{
return $this->soumissionAbstractMultiThemes;
}
public function setSoumissionAbstractMultiThemes(?bool $soumissionAbstractMultiThemes): self
{
$this->soumissionAbstractMultiThemes = $soumissionAbstractMultiThemes;
return $this;
}
public function getSubTitle()
{
return $this->subTitle;
}
public function setSubTitle($subTitle): self
{
$this->subTitle = $subTitle;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
public function getSubEvenements(): Collection
{
return $this->subEvenements;
}
public function addSubEvenement(self $subEvenement): self
{
if (!$this->subEvenements->contains($subEvenement)) {
$this->subEvenements->add($subEvenement);
$subEvenement->setParent($this);
}
return $this;
}
public function removeSubEvenement(self $subEvenement): self
{
if ($this->subEvenements->removeElement($subEvenement)) {
// set the owning side to null (unless already changed)
if ($subEvenement->getParent() === $this) {
$subEvenement->setParent(null);
}
}
return $this;
}
/*
public function setSubEvenements($subEvenements)
{
$this->subEvenements = $subEvenements;
return $this;
}
*/
public function getChild(): ?self
{
$children = $this->subEvenements ? $this->subEvenements->filter(function(?Evenement $evenement = null) {
return $evenement && $evenement->getStatus() == Evenement::STATUS_VALIDATED;
}) : null;
return $children && $children->first() ? $children->first() : null;
}
public function getSettings(): array
{
if (is_null($this->settings)) {
$this->settings = [];
}
return $this->settings;
}
public function setSettings($settings): self
{
$this->settings = $settings;
return $this;
}
}